Skip to content

Parser Rules

Christian Sterzl edited this page Sep 30, 2014 · 1 revision

The default parser rules are very basic. Better results and a cleaner output can be expected if the parser rules are more fine grained.

To define parser rules just overwrite them in the configuration either as object or as a path to a json object, which will be loaded after the editor has loaded. At the moment it is a known issue, that the parser rules are still loading, even though the editor throws already the loaded event.

So define your parser rules either as object:

{
  parserRules: {
  [...]
  }
}

Or as a path to a json file:

{
  parserRules: '/static/parserrules.json'
}

There are some predefined sets of parser rules in the folder parser_rules. They are taken from [https://github.com/Edicy/wysihtml5/tree/master/parser_rules] and converted to valid json files. You will find [here|https://github.com/Edicy/wysihtml5/tree/master/parser_rules] versions with plenty of comments, which help you to find the best parser rules for your needs.

The same counts for pasteParserRulesets.

Clone this wiki locally