fletcher / MultiMarkdown-4

This project is now deprecated. Please use MultiMarkdown-6 instead!
https://github.com/fletcher/MultiMarkdown-5
Other
307 stars 59 forks source link

Header Anchor Links #77

Closed trans closed 10 years ago

trans commented 10 years ago

Header's that are links that only provide "hash tags" for their URL, should also add an id to the rendering of the tag.

# [Something](#something)

becomes

<h1><a id="something" href="#something">Something</a></h1>

This allows document anchors to work properly.

fletcher commented 10 years ago

I'm not sure I follow what you're suggesting here. What's wrong with the current approach, and how is it fundamentally different than what you're suggesting?

trans commented 10 years ago

Currently it renders to just:

<h1><a href="#something">Something</a></h1>

Which is rather useless because without the id attribute entering the url http://foo.com#something will not take us to the anchor.

Note, I've read examples where name is used instead of id, but the a tag (nor the h* tags) appear to support the name attribute any more. So I think id is the best choice even though browsers seem to support both.

Also, id could be put on the h1 instead:

<h1 id="something"><a href="#something">Something</a></h1>

It should work just as well either way. But I suspect it is easier to add it to the a tag in implementation.

fletcher commented 10 years ago

Not sure what you're doing, but it renders this:

<h1 id="something"><a href="#something">Something</a></h1>
trans commented 10 years ago

Oh nice! Sorry, I was running it through the wrong parser (github's) and thought it would be the same --MultiMarkdown is first parser I have seen that does this right! :+1:

Another issue bits the dust!

fletcher commented 10 years ago

GitHub doesn't use MultiMarkdown.