Skip to content

"Failed to find closing <p>" when newline and text is present, and newline not in the final result with breaks: true #158

@spctrlth

Description

@spctrlth

For example, the following is correct:

iex(1)> EarmarkParser.as_ast("z\nz", %EarmarkParser.Options{breaks: true})
{:ok, [{"p", [], ["z", {"br", [], [], %{}}, "z"], %{}}], []}

It puts everything in a paragraph and the newline is turned into a br tag (as expected because of the breaks: true option)

However, when we put tags ourselves, in this case p tags, but also happens with other HTML tags

iex(1)> EarmarkParser.as_ast("<p>z\nz</p>", %EarmarkParser.Options{breaks: true})
{:error, [{"p", [], ["z", "z</p>"], %{verbatim: true}}],
 [{:warning, 1, "Failed to find closing <p>"}]}

The newline \n is not converted to a br tag (may be related to #119 ?), and the closing tag is seen as part of the text instead of being detected as the closing tag.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions