-
Bug
-
Resolution: Invalid
-
Low
http://packages.python.org/Markdown/extensions/attr_list.html
This extension enables adding custom attributes to rendered elements. While I realize this is potentially dangerous, it does have one very good use, which already sort-of works, but it's pretty broken. Being able to add IDs to headers is awesome, and enables users to create in-page links ("anchors") in their documents.
Right now, what happens is the following - this code:
[Some link][#link-id]
...renders correctly as
<a href="#link-id">Some link</a>
enabling us to create links like this. On the other hand, this code:
Some header {: #link-id} ------------------------
...renders as the following HTML:
<h2 id="some-header-link-id">Some header {: #link-id}</h2>
thus losing the ability to use the custom IDs. So, it appends the ID the user wants to the auto-generated ID, and also outputs the extra code as plain-text.
I understand that this could introduce other problems, such as elements with duplicate IDs, which could lead to even weirder bugs if a users uses the same IDs as the Bitbucket page does (e.g. javascript/css bugs etc.), but this could maybe be solved by namespacing the custom IDs (e.g. {: #link-id} could be translated to "markdown-link-id" or something), or even better, only allowing custom namespaced IDs, so {: #markdown-link-id} would successfully set an element's ID, while {: #link-id} would be ignored. The latter is better because each file would be able to be correctly rendered on its own in places other than Bitbucket obviously (if someone else were to use a different "namespace" or whatever).
Of course, if this is a lot of work (and just explaining it seems to get complicated), just having the basic functionality and relying on users not to intentionally break something would be awesome.
In any case, the current output seems fairly broken, so just thought I'd share.
Thanks!