-
Notifications
You must be signed in to change notification settings - Fork 73
Add name attribute to heading anchors, fixes #231 #232
Conversation
Happy to talk about how to make this an option rather than a default though it seems unobtrusive and more sensible to me. Not sure why GitHub don't do this as it would also provide a fallback when Javascript is disabled. |
It seems the |
Seems relevant: markdown-it/markdown-it#28 |
i'm not entirely sure that adding the @kasbah what does |
On http://render-readmes.preview.kitnic.it/boards/github.com/JarrettR/USBvil/, for instance, it makes the deep links work by default without interfering with the I believe if this was used on npm, it would make the deep links work with javascript disabled. I am not sure why it should be an anti-pattern. On markdown-it/markdown-it#28 they mention "dom clobbering" but, if I understand that term correctly (which I am really not sure of), it seems less worse than not working anchor links. |
Yeah it's a way to make things work without JavaScript. The |
But Would be happy to put this behind an option Let me know, and I will implement it. I deployed my fork to https://kitnic.it and it works fine for me, but am anxious to upstream this. |
Hmm. I definitely understand where you're coming from, but since var $ = marky(whatever)
$('a.deep-link').each(function() {
var $el = $(this)
$el.parent().attr('name', $el.attr('href').substring(1))
}) (or similar, I didn't test this) @ashleygwilliams thoughts? |
That would be perfectly usable and it's a small thing to do a work-around on my end. I just have to vent though and say I don't really understand the deprecation of |
Interestingly, it looks like HTML5 does specify that |
@kasbah Thanks for the PR for sure, but I think for now we'll hold off, given the standards & GH behavior and the availability of a workaround. We can definitely revisit this once we've hit feature parity with GH's rendering. |
No problem, awaiting merge of #225 and then I'll do the workaround on my end like you suggested. Thanks for your time! |
This makes the anchor tags work by default by adding a
name
attribute.