Skip to content Skip to sidebar Skip to footer

Markdown="1" Not Working Inside The P Tag

I'm using this line

## Download tarball

and I'm getting the actual same text as HTML. example Any help will be appreciated.

Solution 1:

markdown="1" is a common, albeit non-standard, method to alter the behavior of a Markdown parser. Specifically, standard Markdown ignores Markdown syntax wrapped inside block-level HTML tags. With an appropriate extension enabled, adding markdown="1" as an attribute to the wrapping HTML tag will instruct the Markdown parser to not ignore Markdown syntax within the tag. However, you need to be using a Markdown implementation which includes support for the feature and enable the feature if it is not enabled by default.

For example, PHP Markdown Extra documents the feature this way:

Markdown Extra gives you a way to put Markdown-formatted text inside any block-level tag. You do this by adding a markdown attribute to the tag with the value 1 — which gives markdown="1" — like this:

<div markdown="1">
This is *true* markdown text.
</div>

The markdown="1" attribute will be stripped and <div>’s content will be converted from Markdown to HTML. The end result will look like this:

<div>

<p>This is <em>true</em> markdown text.</p>

</div>

Note that the Markdown parser strips out the markdown="1" attribute as it is not a valid HTML attribute. It only has meaning for some "extended" Markdown parsers.

For completeness, the original Markdown rules explain that Markdown syntax is ignored when wrapped in HTML:

Note that Markdown formatting syntax is not processed within block-level HTML tags. E.g., you can’t use Markdown-style *emphasis* inside an HTML block.

That being the case, the following Markdown:

<div>
This is *true* markdown text.
</div>

Would generate the following HTML when passed through a Markdown parser:

<div>
This is *true* markdown text.
</div>

Solution 2:

There is no markdown HTML attribute. Maybe you're working in some framework that is supposed to add that capability, and it's not working right?

Post a Comment for "Markdown="1" Not Working Inside The P Tag"