earmark_parser
earmark_parser copied to clipboard
Faulty parsing of ** in strong code block
I was doing some markdown of inline C code and noticed that the parser interprets ** inside ` as the end of the emphasis.
iex(1)> EarmarkParser.as_ast "**`**`**"
{:ok, [{"p", [], [{"strong", [], ["`"], %{}}, "`**"], %{}}], []}
There is a simple workaround by using __ instead as the emphasis marker. i.e.
iex(2)> EarmarkParser.as_ast "__`**`__"
{:ok,
[
{"p", [],
[{"strong", [], [{"code", [{"class", "inline"}], ["**"], %{line: 1}}], %{}}],
%{}}
], []}
Commonmark compatibilty is not the primary goal but I will try to make this as common mark compatible as possible when decision choises are of, more or less, equal complexity.