fletcher / MultiMarkdown

Expanded perl version of John Gruber's original Markdown --- No longer under active development since MMD 3
http://fletcherpenney.net/multimarkdown/
1.06k stars 530 forks source link

extended attributes do not work with numeric reference links #23

Closed jmay closed 14 years ago

jmay commented 14 years ago

If you have a reference link of the form

[my label][1]

and extended attributes:

[1]: http://example.com/ "title here" class=myclass

Where the link id is entirely numeric ("1" above).

Then the extended attributes are ignored. This is because Header2Label strips off leading numerics from the link id, leaving it blank, so _DoAttributes is called with blank instead of the proper link id.

Workaround is to add a leading non-numeric character to the link id. Is there a reason for Header2Label not to allow leading numerics?

-Jason

fletcher commented 14 years ago

They're not allowed in XHTML.

jmay commented 14 years ago

I don't understand - these id strings never appear in the XHTML output, they're only used to match up the reference information with the link.

Now I see - you're using the same Header2Label function to auto-construct ids for headers.

In _DoAnchors, could we change _DoAttributes($label) to _DoAttributes($link_id)?

fletcher commented 14 years ago

I'm sorry - I will not be changing the way this works - the return for the time it would take me is not enough.

You are certainly welcome to tweak your own version of MMD to fit your needs. Otherwise, I suggest using an alternative naming strategy.