HaxeFoundation / haxe-markdown

A Markdown parser in Haxe.
MIT License
63 stars 24 forks source link

handle links with parentheses in them #35

Closed Antriel closed 4 years ago

Antriel commented 4 years ago

I couldn't get tests to run, so only tested on my use case. I'm also not great at regex, so if someone could sanity-check, I would appreciate it.

Gama11 commented 4 years ago

I've made some changes that allow running the tests on eval with cd test && haxe targets.hxml. However...

FAILED
Tests: 136  Passed: 106  Failed: 30 Errors: 0 Ignored: 0 Time: 0.37077

Anyway, I've added a test case for this and your fix seems to work (and doesn't make any more tests fail), so thanks!

Gama11 commented 4 years ago

Hm, while this did apparently fix what it was supposed to fix, it also broke parens outside of the link:

trace(Markdown.markdownToHtml("Haxe (see also: [link](https://haxe.org/))"));

now gives:

<p>Haxe (see also: <a href="https://haxe.org/)">link</a></p>

rather than:

<p>Haxe (see also: <a href="https://haxe.org/">link</a>)</p>

Considering this was originally ported from https://github.com/dart-lang/markdown, we should probably check how they do it there rather than try to fix it ourselves.

Anyway, I'll revert the commit for now.