computation of header ids

Alexandre Leray newsletters at alexandreleray.com
Thu Sep 22 09:01:44 EDT 2011


Hi,

I'm using the header id extension from markdown extra and in my
perception it gets wrong when I use attributes on headers, for instance:

>>> md = markdown.Markdown(['extra'])
>>> md.convert('# My header {@class=red}')
u'<h1 class="red" id="my_header_classred_1">My header </h1>'

I would have expected:

u'<h1 class="red" id="my_header">My header </h1>'

An other example:

>>> markdown.markdown("# Test {@style=position: absolute; top: 100px;
left: 455px; width: 300px; height: 250px;}
{@about=http://video.constantvzw.org/Ellentriek8/softsensor_pure_d.ogv}", ['headerid'])
u'<h1
about="http://video.constantvzw.org/Ellentriek8/softsensor_pure_d.ogv"
id="test_styleposition_absolute_top_100px_left_455px_width_300px_height_250px_abouthttpvideoconstantvzworgellentriek8softsensor_pure_dogv"
style="position: absolute; top: 100px; left: 455px; width: 300px;
height: 250px;">Test </h1>

Instead, I'd like:

u'<h1
about="http://video.constantvzw.org/Ellentriek8/softsensor_pure_d.ogv"
id="test" style="position: absolute; top: 100px; left: 455px; width:
300px; height: 250px;">Test </h1>

What do you think? Should it be fixed by stripping {@...} chunks in
_create_id function?

Thanks,

-- Alex


More information about the Markdown-Discuss mailing list