erusev / parsedown

Better Markdown Parser in PHP

Home Page:https://parsedown.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does 2.0.x-dev support markdown=1?

svanlaere opened this issue · comments

While testing 2.0.x-dev it seems that markup like this is currently unsupported?:

<address markdown=1>E-mail: [noreply@foobar.test](mailto:noreply@foobar.test)</address>

Is there a solution?

Hi! This version isn't released yet, but the plan is to switch to CommonMark's method of handling HTML and not use markdown=1 anymore (CommonMark method documented here). This makes things much simpler because it is no longer necessary to parse HTML, making this switch has fixed a few long standing bugs that were caused by this HTML parsing IIRC.

In practice this just means leaving a blank line if you begin a line with HTML:

<address>

E-mail: [noreply@foobar.test](mailto:noreply@foobar.test)
</address>

This is only necessary for HTML blocks (where the beginning of the line starts with HTML), for "raw HTML" (inline HTML) you can just mix markdown with HTML tags without any special considerations, within reason.

E.g. this would work as you're expecting:

foo <address>E-mail: [noreply@foobar.test](mailto:noreply@foobar.test)</address>

Indeed leaving a blank line solves this issue, thanks for the reply.
Looking forward for a official 2.0 release.