5

Is there an extra for Python Markdown that supports Markdown inside HTML block elements, e.g. div, p

i.e. is there a way to convert this:

<div id="content">
    [Google](http://www.google.com)
</div>

to

<div id="content">
    <a href="http://www.google.com>Google</a>
</div>

using Python Markdown or a Python Markdown extension? I'm looking for something similar to this feature in PHP Markdown Extra

3 Answers 3

4

The relevant bug report states that the extra extension adds that: https://github.com/waylan/Python-Markdown/issues/80

Then you can add markdown="1" to div tags to have markdown parsed inside

<div markdown="1">
*markdown*
</div>
Sign up to request clarification or add additional context in comments.

Comments

3

According to this: http://daringfireball.net/projects/markdown/syntax#html

You would have to use a <span> rather than a <div>. Further explanation is available at the above link.

Comments

0

With PHP Markdown Extra (not Python, I know, but relevant), you can do this by adding the attribute markdown=1 to the block-level element in question.

I’m interested in pure-Python libraries that support the “Markdown Extra” syntax as well.

Of course, one very workable hack would be call out to PHP & PHP Markdown Extra via standard input, from your Python script.

1 Comment

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.