-
Notifications
You must be signed in to change notification settings - Fork 26
Description
It would seem like \ is interpreted incorrect/strange when in a link target. For example
> EarmarkParser.as_ast ~S"[foo](\foo)"
{:ok, [{"p", [], [{"a", [{"href", "foo"}], ["foo"], %{}}, ")"], %{}}], []}I would expect the \ to be part of the href (possibly uri encoded) and the ) should not be visible anywhere. babelmark seems to agree with this.
I noticed that sending two \\ more does what I expect, but the ) is still part of the result when it should not be:
> EarmarkParser.as_ast ~S"[foo](\\foo)"
{:ok, [{"p", [], [{"a", [{"href", "\\foo"}], ["foo"], %{}}, ")"], %{}}], []
You may ask, why would anyone want to put a \ in a link? When improving support for Erlang in ExDoc I need to be able to create links to the c module. Naturally an mfa link to that would looks like this c:ls/0, which ExDoc interprets as a callback. So I was about to add the possibility to escape the c:, so that it is interpreted as a mfa and the natural escape character for me is [shell ls() function](`\c:ls/0`), when I stumbled on this bug.