-
Notifications
You must be signed in to change notification settings - Fork 137
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
Problems parsing HTML code in Markdown file #353
Comments
Thanks for the report, bad regression here 🤕 |
Refs: #353; Setting up tests WIP [skip-ci]
Awesome. |
hi @RobertDober, iex(5)> string = """
...(5)> XXX
...(5)>
...(5)> <h1 align="center">Extra <span class="bold">Page with HTML</span></h1>
...(5)>
...(5)> <p align="center"><img src="image.svg"/></p>
...(5)>
...(5)> Elixir & Erlang
...(5)>
...(5)> ## Section One
...(5)>
...(5)> more text
...(5)> * 1
...(5)> * 2
...(5)> - A
...(5)> - B
...(5)> * 3
...(5)>
...(5)> <h1>Second Main Title</h1>
...(5)>
...(5)> more text
...(5)> """
"XXX\n\n<h1 align=\"center\">Extra <span class=\"bold\">Page with HTML</span></h1>\n\n<p align=\"center\"><img src=\"image.svg\"/></p>\n\nElixir & Erlang\n\n## Section One\n\nmore text\n* 1\n* 2\n - A\n - B\n* 3\n\n<h1>Second Main Title</h1>\n\nmore text\n"
iex(6)> Earmark.as_ast(string)
{:ok,
[
{"p", [], ["XXX"]},
{"h1", [{"align", "center"}],
["Extra <span class=\"bold\">Page with HTML</span>"],
%{meta: %{verbatim: true}}},
{"p", [{"align", "center"}], ["<img src=\"image.svg\"/>"],
%{meta: %{verbatim: true}}},
{"p", [], ["Elixir & Erlang"]},
{"h2", [], ["Section One"]},
{"p", [], ["more text"]},
{"ul", [],
[
{"li", [], ["1"]},
{"li", [], ["2", {"ul", [], [{"li", [], ["A"]}, {"li", [], ["B"]}]}]},
{"li", [], ["3"]}
]},
{"h1", [], ["Second Main Title"], %{meta: %{verbatim: true}}},
{"p", [], ["more text"]}
], []}
I would like to get an HTML tree in Thank you. |
😨 Everything is possible 😉 But when and how is the question, this looks like quite a massive rewrite to me and I have still some bugs. What bugs (stupid pun) me is that I cannot myself estimate the priorities for So maybe Milestone 1.5, maybe only with a new option which might even allow to not parse HTML at all!!! Personally I |
Please do so in a new ticket, I prefer that I see who had the idea of an enhancement so I would prefer if you could open a new ticket. Thx |
Well. main case is that before using AST in ExDoc it was supported, so it's a backward compatibility issue. Not a big one since we haven't reached v1.0, but something to have in mind. The main reason for having it is because we need to escape special chars such as I will create a new issue with the feature request. Thank you! |
Actually that is not really so, the inner html was just parsed as text and rendered as text, do you do something fancy with the text nodes that are just html when rendering them? I might see another problem here, the missing Have you actually tested that already, or is that not the problem? |
The master version of doesnt work with ExDoc, because it expects 3-element tuples, but the verbartim info is in a 4th element.
|
yep I replied there thx, all parsed html tags have this meta information, I forgot it for oneliners |
Originally reported here: elixir-lang/ex_doc#1189 (comment)
When parsing HTML code, it wlil leave the closing tag as part of the text,
here's an example.
You can see it in
elixir-lang/ex_doc#1190 is the PR in ExDoc trying to close this bug.
Thank you.
The text was updated successfully, but these errors were encountered: