From: Waylan L. <way...@ic...> - 2014-08-25 23:59:15
|
Dave, I assume you are referring to access to the parse tree from which you can render your own output. I know a few Markdown parsers that do this. The most notably being Pandoc which outputs to a wide variety of formats (unfortunately, Pandoc is not a python library although someone may have written a python library that wraps Pandoc's command line interface -- which admittedly does not give you access to the parse tree). There are a few C libraries out there that either have a Python wrapper or can easily be wrapped in Python that offer access to their parse tree (sorry I forget which ones). And most recently, [Mistune][1] was created, which is a Python port of the JavaScript Marked library. I haven't taken a real close look at Mistune, but **if** it is a good port of Marked then I would say that it is exactly what I would do if Python-Markdown's existing code, user base, and extension API didn't already exist. I just can't see maintaining the existing API and moving to such a different way of parsing Markdown text. I think there is plenty of room for both implementations to thrive. That said, while Python-Markdown doesn't technically generate a parse tree - it does create the entire document as an ElementTree, and the serializer can be swapped out for your own - so you could write your own serializer which output XML if you desired. Of course, you would then have to work out how to handle the Postprocessors that run after the serializer - but it's not impossible. See this [test][2] which demonstrates how to swap out the serializer. [1]: https://github.com/lepture/mistune [2]: https://github.com/waylan/Python-Markdown/blob/master/tests/test_apis.py#L38 6 -----Original Message----- From: Dave Pawson [mailto:dav...@gm...] Sent: Sunday, August 24, 2014 2:09 AM To: Waylan Limberg; PythonMD list Subject: [Python-markdown-discuss] Ideas for future development. Very personal one. I've an XML background. I can do things with XML I can't with plain text. Idea for future development. Isolate the mapping of input markup to output syntax. Possibly isolating block and inlines. That would allow replacement of html with XML. (Ideally allowing extensions to use this form) regards -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk ---------------------------------------------------------------------------- -- Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/ _______________________________________________ Python-markdown-discuss mailing list Pyt...@li... https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss |