earmark_parser icon indicating copy to clipboard operation
earmark_parser copied to clipboard

Faulty parsing of ** in strong code block

Open garazdawi opened this issue 2 years ago • 1 comments

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}}], %{}}],
    %{}}
 ], []}

garazdawi avatar Dec 06 '23 09:12 garazdawi

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.

RobertDober avatar Jan 16 '24 11:01 RobertDober