Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
LinkReferenceDefinition followed by setText with blank line #395
How the following should be parsed?
While implementing my parser, I'm generating a LinkReferenceDefinition and a proper Setext heading But with the default CommonMark implem, it treats Settext heading as a plain paragraph.
In my implems it outputs:
<h1>Test</h1> <a href="/url" title="title">foo</a>
but cmark generates this:
<h1>[foo]: /url "title" Test</h1> <p>[foo]</p>
Actually, current cmark gives:
[foo]: /url "title" Test
The spec is currently unclear about this. It says that a link
The parsers use the following method: when they've accumulated
+++ Alexandre Mutel [Feb 19 16 01:29 ]:
I think this is really an implementation bug rather than a problem with the spec.
So the implementation needs to be fixed; we need to resolve link references before generating a setext header (and check that there's still some residual paragraph content left).
referenced this issue
May 1, 2017
I think this is related to #461.
Not only link reference definitions have to be stripped, (after that) also leading and trailing whitespace.
There is still a problem, though:
If there is nothing left to turn this into a setext header, what's supposed to happen with the line of equals signs?
markdig seems to swallow them: http://johnmacfarlane.net/babelmark2/?normalize=1&text=%5Ba%5D%3A+b%0A%3D%3D%3D%3D%3D%3D.
The problem is that checking for the link reference definition should IMHO be "undoable".
Does this sound reasonable?
Checking if the line
Also, it would seem strange to me if the parser creates a link reference while parsing something that in the end turns out to be no match.