erusev / parsedown

Better Markdown Parser in PHP
https://parsedown.org
MIT License
14.76k stars 1.12k forks source link

Does 2.0.x-dev support markdown=1? #822

Open svanlaere opened 2 years ago

svanlaere commented 2 years ago

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?

aidantwoods commented 2 years ago

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>
svanlaere commented 2 years ago

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