Fossil Forum
Post: Markdown: `[hash] (remark)` becomes a link to "remark"
Fossil's Markdown accepts white space between the ] and the ( of an inline link (char_link() in src/markdown.c: "skip inter-bracket-whitespace ... much more lax than original markdown syntax"). The Markdown rules page does not mention it. Together with Fossil's [hash] references, this catches ordinary prose. A Tk ticket comment had:
Fixed on branch x11-nonlatin-shortcuts in [b052917bd2] (based on main), with test `event-8.2`.
and fossil test-markdown-render gives:
<p>Fixed on branch x11-nonlatin-shortcuts in <a href="based on main">b052917bd2</a>, with test <code>event-8.2</code>.</p>
The remark disappears, and the reference to the check-in becomes a link to the relative URL "based on main". Fossil 2.21, 2.26, 2.28 and trunk 06ef844171 behave the same.
A parenthesis after a reference is common in commit and ticket comments ("fixed in [abc123] (on core-9-0-branch)"), and the writer has no hint that it means something else. CommonMark allows no white space there, so [b052917bd2] (based on main) is the text with a reference followed by a remark.
Could the lax rule be dropped, or at least not apply when the bracket holds a hash, or when the parenthesis holds white space? A URL in an inline link cannot contain unescaped white space in CommonMark anyway.
This has been addressed in check-in 852e7b61b6ca874.