RobertDober / earmark_parser

The Markdown to AST part of Earmark.
Apache License 2.0
68 stars 26 forks source link

Content after <sup> gets discarded #31

Closed lexmag closed 3 years ago

lexmag commented 3 years ago

To reproduce:

EarmarkParser.as_ast(~S"""
<sup>1</sup>`Msgpax.Packer` foo

<sup>2</sup>NaN bar
""")

v1.4.12 gives:

[
  {"sup", [], ["1"], %{verbatim: true}},
  {"sup", [], ["2"], %{verbatim: true}}
]
RobertDober commented 3 years ago

Same reasoning as in #30 https://github.com/RobertDober/earmark_parser#html-blocks

wojtekmach commented 3 years ago

@RobertDober sorry for piling on, is the following also expected given current implementation? That is we have raw html in the same line but after some markdown.


md = """
*foo* <em>bar</em>
"""

Earmark.as_html!(md)
|> IO.puts()
# Outputs:
# <p>
# <em>foo</em> &lt;em&gt;bar&lt;/em&gt;</p>

EarmarkParser.as_ast(md)
|> IO.inspect()
# Outputs:
# {:ok, [{"p", [], [{"em", [], ["foo"], %{}}, " <em>bar</em>"], %{}}], []}
# NOTE: no %{verbatim: true}!
RobertDober commented 3 years ago

Yes indeed HTML is only parsed as such if in its own line, I should be working on this, alas, I am very busy looking for a job.

RobertDober commented 3 years ago

and no need whatsoever to apologise 😉