Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Better (and documented) Support for markdown="1" #52

Closed
Mekk opened this Issue · 4 comments

4 participants

@Mekk

PHP Markdown allows one to use markdown inside HTML blocks - simply by adding markdown=1 attribute to appropriate HTML block.

It would be nice if python markdown also allowed for such a feature.

I faced the problem after migrating my blog from PHP to Python but seems I am not the only one. It is useful in cases like

<div class="blahblah" markdown="1">
Some *normal* markdown [text][] here.
</div>

or

<blockquote markdown="1">
Some *markdown text*

<pre name="code" class="python">
# code block which is to stay inside blockquote
</pre>

Yet another *markdown text*
</blockquote>
@waylan
Owner

PHP Markdown allows one to use markdown inside HTML blocks - simply by adding markdown=1 attribute to appropriate HTML block.

Actually, PHP Markdown Extra supports that feature -- as does the Extra Extension of Python-Markdown. Unfortunately, it is not documented as the feature doesn't work consistently due to limitations of our rudimentary html parser. Of course, patches are always welcome.

I should also note that unlike all other features of the Extra Extension, this feature is built right into the markdown core and is simply turned on with a flag by Extra. See the source for details.

@waylan waylan closed this
@waylan waylan reopened this
@waylan
Owner

Upon further consideration, I'm reopening this as a "feature" to implement "someday-maybe". Note that I changed the title to: Better and documented Support for markdown="1"

@Kaba2

Hi,

I would like to encourage in implementing this feature. I am using Python Markdown in a documentation system which extends the capabilities of Markdown by macros. These macros construct things in Markdown and html, and embed them in html-div blocks, so that they can be styled by CSS. This works in Python Markdown 2.0 (well enough for me), but not in Python Markdown 2.2, so I am unable to upgrade.

Kalle

@mentat-fr

Hi,

in my source file I put div for layout control.

Operation with the tag markdown = "1" works perfectly.

Except when another div is included inside div.
In this case python markdown put the div inside a paragraph.

Example:

<div markdown="1">

## Header

<div markdown="1">
    blabla **strong** ...
</div>

</div>

Output:

<div>

<h2>Header</h2>

<p><div markdown="1">
    blabla <strong>strong</strong> ...
</div></p>

</div>

As for php extra markdown, I use otherwise, the correct output is:

<div>

<h2>Header</h2>

<div>
    blabla <strong>strong</strong> ...
</div></p>

</div>

with no extra <p> and <div> markdown attribute.

Do you know how to fix this? (sorry I'have no Python skill ...)
Or can we expect a futur version with this behavior?

Many thanks.

@ryneeverett ryneeverett referenced this issue from a commit
@ryneeverett ryneeverett Issue #52 daa2d46
@ryneeverett ryneeverett referenced this issue from a commit
@ryneeverett ryneeverett Issue #52
Miscellaneous improvements and bug fixes.
48dc39e
@ryneeverett ryneeverett referenced this issue from a commit
@ryneeverett ryneeverett Issue #52
Miscellaneous improvements and bug fixes.
07069a3
@waylan waylan closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.