GFM and CommonMark compatibility
GULPF opened this issue · comments
The roadmap mentions correctness, but doesn't further explain what that means. There is no consensus on what correct handling of markdown is, see for example Babelmark which compares the output of 20 different markdown implementations. Here's just one example where the issue becomes obvious.
Have you considered making this an implementation of the GFM spec? GFM is an extension of the CommonMark spec made by GitHub, which includes support for tables and several other non-standard markdown features. By making it possible to enable/disable the extensions in the API, it would also be an implementation of CommonMark itself.
@GULPF Thanks for the proposal. I've added the GFM implementation as the top priority as stated in README.md. In the next few days, I'll try to let the codebase pass the GFM test cases. <3
The corresponding work is in gfm-dev
branch. So far, 201/603 of given gfm examples passed. I'll merge the code constantly into the master branch. During the transition, some gfm features are not rendered but more close to marked. I'll keep the confusions as less as possible.
As of now (v0.7.1), nim-markdown has passed all 649 cases defined in commonmark v0.29 spec. Certain GFM extensions have been implemented, such as HTML table, strikethrough. I'll polish the code and work on the other GFM extensions in the next few weeks, such as task list items, disallowed raw HTML, etc.
You can now get a commonmark-compatible markdown parser by calling:
let html = markdown(md)
# or
let html = markdown(md, config=initCommonmarkConfig())
or, get a partially-implemented gfm parser by calling:
let html = markdown(md, config=initGfmConfig())