Please help me to choose the right C-based Markdown parser/HTML-converter for my project. I plan to utilize Gnome Text Editor (C- / GTK- / GtkSourceView-based) to implement a text editor for my custom syntax that is similar to Markdown. It should have following features:
- Ability to recursively include other documents of the same syntax before converting them to HTML.
- Live Preview - user should be able to see HTML-rendered output while typing; also of documents containing inclusions. (I plan to use WebkitGTK for displaying HTML).
- Synchronized scrolling - scrolling the window of the source document should automatically scroll the HTML view (always showing the rendered results of the currently visible area of the source).
- I was considering between md4c, MultiMarkdown and cmark - which of them is better suited for that task? Or maybe you have other candidates?
- I think I’ll have to take a Markdown parser and just rewrite those parts that recognize Markdown syntax substituting them by my own. Hardcoded so to speak. But maybe there is a parser that can be sort of extended without touching its core?
- I’ve learned that Cmark relies on abstract syntax tree (AST), but do I really need it to achieve the above mentioned goals (especially synchronized scrolling)? If not - I probably would prefer to use MD4C which is faster and requires less memory (as my target documents are pretty long books with a lot of chapter-inclusions).
- How should one implement Live Preview efficiently? Is there something like “incremental HTML-conversion”? I.e. if user edits a 10K lines long document (let’s say after expanding file inclusions) - it is probably not a good idea to render all those 10K lines from the very beginning each time he types just one more character?
Thank you in advance!