fletcher / MultiMarkdown-5

Reference implementation of MultiMarkdown; replaces MultiMarkdown v4 (deprecated -- see MMD-6 instead)
https://github.com/fletcher/MultiMarkdown-6
Other
293 stars 46 forks source link

Bug in MultiMarkdown 5.2.0 that will render Markdown within HTML block when it should not #21

Closed ickc closed 7 years ago

ickc commented 8 years ago

In my own test file, I have something like this: (modified from the documentation)

<div>This is *not* MultiMarkdown</div> test

<div markdown=1>This *is* MultiMarkdown</div>

In the previous versions of MMD, the first line is not in Markdown (as the documentation suggest). But in the latest version of MMD (5.2.0), somehow if there are some texts after the div, MMD will render the text within the div as Markdown.

fletcher commented 8 years ago

Thanks for submitting this -- I am looking into a few things related to recent changes in the MMD parser. Trying to balance accuracy with performance.

fletcher commented 8 years ago

Actually, the first line has always been parsed as Markdown in older versions of MMD. It has to do with whether the html in question is a block element in terms of Markdown (e.g. a paragraph on its own), or part of a Markdown paragraph. When you add the " test" to the end, the <div> becomes part of a paragraph and is handled differently.

I'm working on a new parser, so this will be handled differently at some point in the future. But I did want to point out that this is not a new development.

fletcher commented 7 years ago

MMD v 6 is now in alpha. I won't be spending much time updating MMD 5 any more, as I my development time should be spent finishing (and then polishing) MMD 6.

MMD 6 will handle HTML blocks in a different way, however. It is based roughly on the way CommonMark handles HTML. In short, by adding or removing whitespace between the HTML wrapping tag and the contents, you can change whether MultiMarkdown syntax is processed inside the tag.

http://spec.commonmark.org/0.27/#html-blocks

https://github.com/fletcher/MultiMarkdown-6/