aoloe / scribus-plugin-gettext-markdown

Text importer for loading Markdown text into Scribus files.
21 stars 2 forks source link

Find a library for parsing markdown files #3

Open aoloe opened 11 years ago

aoloe commented 11 years ago

If possible something qt based.

aoloe commented 11 years ago

here are a few qt based markdown editors or otherwise markdown related projects:

aoloe commented 11 years ago

a -- simple -- sample parser implementation: http://www.qtcentre.org/threads/30707-Parse-Text-File-with-Qt

aoloe commented 11 years ago

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

aoloe commented 11 years ago

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)

aoloe commented 11 years ago

in the scribus code the about files look like markdown ones: http://scribus.net/svn/Scribus/trunk/Scribus/scribus/ui/about.cpp

aoloe commented 11 years ago

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.

aoloe commented 11 years ago

a peg parser may be a better idea: