yogthos / markdown-clj

Markdown parser in Clojure
Eclipse Public License 1.0
540 stars 120 forks source link

Link reference parsing is a bit too strict #182

Closed algernon closed 2 years ago

algernon commented 2 years ago

I've recently migrated my static site generator from pegdown to markdown-clj, and noticed that markdown-clj is a lot stricter in many cases where I believe it shouldn't be. For example, reference links like [some text][foo:bar] or [some text][foo/bar] are not allowed (as in: they're not recognised as link references, causing misrendering, and markdown appearing in the html verbatim), while pretty much any other markdown parser handles them fine, and my reading of the CommonMark spec suggests that these should be valid references, too.

I suspect this is the place, but there are a couple of other places in that file with similar-ish regexes, so I'm not sure.

I'd like to inquire whether a pull request that relaxes the restriction, and allows both : and / in references would be accepted? With appropriate tests included, of course.

yogthos commented 2 years ago

I'm definitely open to extending the functionality to be compatible with other parsers. The regex is indeed the spot that handles reference parsing, and a PR would be very welcome. As long as the current tests pass, I don't see a problem extending functionality for new cases.

algernon commented 2 years ago

Sweet. I'll see what I can do over the next few days!