Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how HTML parsing works #357

Closed
RobertDober opened this issue Jun 22, 2020 · 6 comments · Fixed by #360
Closed

Document how HTML parsing works #357

RobertDober opened this issue Jun 22, 2020 · 6 comments · Fixed by #360

Comments

@RobertDober
Copy link
Collaborator

RobertDober commented Jun 22, 2020

Spinoff from #356

The following shall go into the documentation:

Also check why oneline tags are broken? Did I miss a regression in #353?


Here is what kind of HTML Earmark supports, and I will update the documentation which is not good (was even missing lately)

  • Oneline HTML Tags
   <tag...>{content}</tag>{suffix}

which will render

   {"tag", [], ["content"], %{verbatim: true}} # 1.4.6 format
  • One level of a block
<tag>
    {content}
</tag>
{"tag", [], [content], %{verbatim: true}}
@RobertDober RobertDober self-assigned this Jun 22, 2020
@RobertDober RobertDober added this to the 1.4.6 milestone Jun 22, 2020
@sreyansjain
Copy link

sreyansjain commented Jun 23, 2020

Earmark.as_html!("<mark>Test</mark>")

produces

"<p>\n  &lt;mark&gt;Test&lt;/mark&gt;\n</p>\n"
Earmark.as_html!("<span>Test</span>")

produces

"<p>\n  &lt;span&gt;Test&lt;/span&gt;\n</p>\n"

It was fine in 1.4.4

@sreyansjain
Copy link

In 1.4.4 Tweet embedding as is worked. But now its getting incorrectly parsed in 1.4.5

You can try with this

<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Destiny does not happen without action.</p>&mdash; Mikael Cho (@mikaelcho) <a href="https://twitter.com/mikaelcho/status/1275454780819685377?ref_src=twsrc%5Etfw">June 23, 2020</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

@RobertDober
Copy link
Collaborator Author

@sreyansjain thank you for your comment

I do not think the current behavior or 1.4.4 is what we want, we want a oneline tag to be parsed as HTML

Concerning your Tweet example, that will definitely not work in 1.4.* but hopefully in 1.5 (c.f. #358)

@RobertDober
Copy link
Collaborator Author

Also document how comments are parsed #361

@lud
Copy link

lud commented Jul 6, 2020

Hello,

I found that

    """
    <meta>
    key value</meta>


    Hello
    """

Parses as

[
  {"meta", [], ["key value</meta>", "", "", "Hello"],
   %{meta: %{verbatim: true}}}
]

@RobertDober
Copy link
Collaborator Author

This will be fixed in 1.4.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants