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

Parse HTML recursively #7

Open
RobertDober opened this issue Jul 1, 2020 · 1 comment
Open

Parse HTML recursively #7

RobertDober opened this issue Jul 1, 2020 · 1 comment

Comments

@RobertDober
Copy link
Owner

RobertDober commented Jul 1, 2020

This would superseed Earmark#356 and is inspired by
Earmark#353.

Basic idea

let the scanner be a little be more intelligent and scan the following line

<div> hello<br /> <span lang="greek">αλφα</span></div>

as

   [
     OpenTag{div, []}, Text{hello}, VoidTag{br}, 
     OpenTag{span, [{lang, greek}]} Text{αλφα} CloseTag{span}
     CloseTag{div}]
@RobertDober
Copy link
Owner Author

Also provide an option to put the HTML into metadata as discussed in #8.

This was discussed in pragdave/earmark#356 as follows
Do you mean

   {"div", [{"class", "elixir"}] [best code ever] %{verbatim: true}}

--->

   {"div", [{"class", "elixir"}] [best code ever] %{verbatim: true, html: ~s[<div class="elixir">best code ever</div>]}}

sure sounds like a sound idea to me.

Remains to be seen if the Option shall be capable of adding the verbatim content for other elements too, which might give

e.g.

     as_ast("<div....</div>**hello**", include_verabtims_for: :all) # :verbatim, :none (default) ?
   {:ok,
          [
               {"div", [{"class", "elixir"}] [best code ever] %{verbatim: true, verbatim_content: ~s[<div class="elixir">best code ever</div>]}
},           {"p", [], [{"strong", [], "hello", %{verbatim_content: "**hello**"}], %{verbatim_content: "**hello**"}], []

--->

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

No branches or pull requests

1 participant