RobertDober / earmark_parser

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

Preserve newlines inside HTML code #97

Closed josevalim closed 2 years ago

josevalim commented 2 years ago

This slightly changes the HTML representation of the underlying nodes.

Before, this html:

<code>
pre
post
</code>

Would come out as:

{:code, [], ["pre", "post"]}

And now it comes out as:

{:code, [], ["pre\npost"]}

While both representations are correct, the second representation where all text nodes are collapsed into one is more common:

iex>  Floki.parse_fragment("<code>foo\nbar</code>")
{:ok, [{"code", [], ["foo\nbar"]}]}
coveralls commented 2 years ago

Pull Request Test Coverage Report for Build 1cc3cacc73aefedc161a248265466add5c093a60-PR-97

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details


Files with Coverage Reduction New Missed Lines %
lib/earmark_parser/ast/emitter.ex 1 83.33%
lib/earmark_parser/ast_renderer.ex 1 96.83%
lib/earmark_parser/ast/renderer/table_renderer.ex 1 92.31%
lib/earmark_parser/helpers/pure_link_helpers.ex 1 95.65%
lib/earmark_parser/helpers/string_helpers.ex 1 75.0%
lib/earmark_parser/helpers.ex 2 88.89%
lib/earmark_parser/helpers/html_parser.ex 2 91.67%
lib/earmark_parser/line_scanner.ex 2 95.41%
lib/earmark_parser/parser/list_parser.ex 2 89.71%
lib/earmark_parser/parser.ex 5 87.72%
<!-- Total: 18 -->
Totals Coverage Status
Change from base Build 199e8dd5d9f9a2fc0415a027ec3d6d8f1aeb7f08: 2.5%
Covered Lines: 887
Relevant Lines: 919

💛 - Coveralls
RobertDober commented 2 years ago

Great, thank you José