Question

I am using Markdownsharp v1.13.

The following statement:

new Markdown().Transform("<section id=\"archives\">\r\n        <p>\r\n            No archives.\r\n        </p>\r\n</section>")

Is wrapping the result into a p element:

> "<p><section id=\"archives\">\n        <p>\n            No archives.\n
> </p>\n</section></p>\n"

Why on earth is it doing that? I thought it should completely ignore, the html tags?

Thanks for your help.

Was it helpful?

Solution

The list of block-level elements that prevent Markdown expansions inside them is hardcoded; see line 590 and following.

This list does not include <section> elements by default (when Markdown was created, HTML5 was distant future), but as you can see, you can easily add other HTML tags to that list.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top