Open aoloe opened 11 years ago
here are a few qt based markdown editors or otherwise markdown related projects:
a -- simple -- sample parser implementation: http://www.qtcentre.org/threads/30707-Parse-Text-File-with-Qt
an implementation in ocaml: https://github.com/MFP/OcsiBlog/blob/master/simple_markup.ml (or https://github.com/mfp/ocsiblog/blob/more-markdown-compat/simple_markup.ml for more standard markdown)
a similar approach in php: https://github.com/erusev/parsedown/blob/master/Parsedown.php
and one in c: https://github.com/vmg/sundown/blob/master/src/markdown.c
this is a good summary of the ways one can work on it:
http://stackoverflow.com/questions/605434/how-would-you-go-about-parsing-markdown
my conclusion is that it's probably best to split the file by line and then analyse each of them (or read the file one line at t time and then parse them)
in the scribus code the about files look like markdown ones: http://scribus.net/svn/Scribus/trunk/Scribus/scribus/ui/about.cpp
qlalr allows to parse a file based on a formal grammar (http://en.wikipedia.org/wiki/LALR_parser)
the main idea is:
reading http://www.cforcoding.com/2010/01/markdown-and-introduction-to-parsing.html seems to show that markdown not being context free, it's hard to create a context free grammar for it.
a peg parser may be a better idea:
If possible something qt based.