Open ZevEisenberg opened 7 years ago
Oh hey, apparently GitHub-flavored markdown now has a spec and reference implementation: https://github.com/blog/2333-a-formal-spec-for-github-flavored-markdown
Yes, GitHub recently switched to CommonMark (plus extensions), which is stricter than the original Markdown spec in several ways. This is one of them.
In MacDown (more precisely, Hoedown), this behaviour can be activated by setting HOEDOWN_EXT_SPACE_HEADERS
. But since MacDown is used by people who want to conform to other syntax rules. I’m not sure what is the best way moving forward.
##text
syntax, and we will be forced to break this existing feature if we add the toggle now.Any easy way to offer users to migrate their documents when they open them?
Fun fact: vmg, the one writing the blog @ZevEisenberg mentioned (a GitHub staff of course), is also the author of Sundown; Hoedown is a fork of Sundown. From that I see how developers converge to CommonMark.
Perhaps, similar to how many text editors allow on-the-fly switching of the parsing language, MacDown could allow switching Markdown renderings on the fly? It's additional complexity for users, but given the fragmented nature of Markdown specs and the ability of organizations like GitHub to extend even the most common specs for their own use, it seems like the best solution available. It could also allow users to choose between, say, CommonMark and CommonMark (GitHub extensions).
Barring such an engineering expenditure though, I think using CommonMark OOTB is probably fine, given GitHub's findings. Unfortunately, supporting GitHub's CommonMark implementation with their extensions would require switching from Hoedown to GitHub's cmark fork, which doesn't product HTML natively (I'm assuming that's what MacDown uses, I haven't looked), so unless Hoedown will be updated, that may be a transition that has to happen anyway.
It's not too important, but we've run into a few rendering issues in Alamofire's various bits of documentation due to these differences, so this is a visible issue if you're using MacDown to edit documents on GitHub.
Presumably nothing further has happened on this?
Headers in Markdown are specified like this:
This should render like so in GitHub:
This in an H2
However, I've recently noticed that headers specified without a space between the
#
and the first character are rendering as##This is an H2
on GitHub pages. I'm not sure if this is intentional, but MacDown should match GitHub's behavior.Here's a test H2 without the space, so we can see if GitHub has changed their behavior:
This is an H2 without a space