Re: Docutils can do Markdown, too

Guenter Milde <[email protected]>
Newsgroups gmane.text.docutils.user
Message-ID <[email protected]>
On 2015-08-06, Stefan Merten wrote:

> Hi!

> Today Tony Narlock wrote:
>> Both remarkdown and recommonmark return a docutils document tree (
>> http://docutils.sourceforge.net/docs/ref/doctree.html#document).

If so, they could be used as alternative parsers: 

* Up to now, Docutils only ships with the standard "rst" parser, however,
  the framework for alternative parsers exists.

* a front-end could set up the parser from either of these projects +
  standard Docutils transforms and standard Docutils writers.

  This could either be a suite of front-ends (md2html, md2html5, md2latex,
  md2xml, md2odt, md2manpage ...) or one "metawriter" with mandatory writer
  argument (``mdocutils html5 mydoc.md``)

It would only be that easy, if the "docutils document tree" returned by
the markdown parser not only uses Docutils nodes and elements but also
follows all the documented and nondocumented conventions and
restrictions.

Otherwise, we might either cooperate with the upstream authors to fit the
alternative parsers into Docutils or add a wrapper layer including
transfomrs required to "sanitize" the document tree before handing it to the
standard transforms and writer.


> Which opens a way to produce reStructuredText from Markdown by using
> `xml2rst`.

One more interesting option 
(and one more incentive to add an "rst" writer to Docutils).  :-)


------------------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.