Closed mattiasnordqvist closed 11 years ago
Yeah, and it wasn't always empty and for some reason Github lost the history. I'll add some docs here and if you say they make sense to you I'll put them on http://epiceditor.com/#custom-parsers
EpicEditor is set up to allow you to use any parser that accepts and returns a string. This means you can use any flavor of Markdown, process Textile, or even create a simple HTML editor/previewer (parser: false
). The possibilities are endless. Just make the parser available and pass its parsing function to the EpicEditor setting and you should be all set. You can output plain text or HTML. Here's an example of a parser that could remove "bad words" from the preview:
var editor = new EpicEditor({
parser: function (str) {
var blacklist = ['foo', 'bar', 'baz'];
return str.split(' ').map(function (word) {
// If the word exists, replace with asterisks
if (blacklist.indexOf(word) > -1) {
return '****'
}
return word;
}).join(' ');
}
}).load();
Here's a Wiki to HTML parser by Remy Sharp used with EpicEditor:
var editor = new EpicEditor({
parser: function (str) {
return str.wiki2html();
}
}).load();
For even more customization and optimization you can replace the default built-in processor on build. Running jake build parser=path/to/parser.js
will override the default Marked build and replace it with your custom script.
Sure, it makes sense to me, but I have not verified that it actually works.
OK, added to the README and index.html docs. If, whenever you use it, you find some bug with it or typo or something let me know.
Wiki seems empty: https://github.com/OscarGodson/EpicEditor/wiki/Using-A-Custom-Parser
Would like to know how I am intended to extend the standard parser.