From: Guenter M. <mi...@us...> - 2022-01-08 17:27:16
|
Dear Takeshi KOMIYA, thank you for the fast reply. On 2022-01-08, Takeshi KOMIYA wrote: > I finished my work. It has been fully compatible with CommonMark. I tested pycmark today and could get it to work with `docutils-cli.py` after a small modification: Running:: docutils-cli --parser=pycmark I got a ``NotImplementedError('subclass must override this method')``. The reason is, that `docutils.parsers.get_parser_class(parser_name)` looks for a `Parser` class inside the module named `parser_name`. However, pycmark/__init__.py imports the upstream base class: from docutils.parsers import Parser I could fix this changing the above import line to import docutils.parsers and the parser class definition to start with class Parser(docutils.parsers.Parser): """CommonMark parser for docutils.""" Now, pycmark.Parser is the CommonMark parser (as expected by Docutils) and `docutils-cli --parser=pycmark` worked as a charm. A quick-and-dirty test run showed that "pycmark" can act as a handy drop-in Markdown/CommonMark parser. The advantage of `docutils-cli --parser=pycmark` over pycmark's `md2html` is, that it offers the choice of all available writers from the command line. > I thought to release v1.0 after that, but I lost my interest for it > because myst-parser has appeared. Would you consider the above change in pycmark (With either adapting or dropping the `md2html` "entry-point")? As a second best alternative, I could write a thin wrapper module in Docutils. We would then have a selection of 3 CommonMark parsers: myst: fully-featured and actively maintained pycmark: lightweight, no further dependencies recommonmark: long standing (also available as Debian package) unmaintained/deprecated :( Thanks, Günter |