naokazuterada / MarkdownTOC

SublimeText3 plugin which generate a table of contents (TOC) in a markdown document.
https://packagecontrol.io/packages/MarkdownTOC
MIT License
301 stars 48 forks source link

autoanchor adds link with id instead of name #130

Closed batracos closed 5 years ago

batracos commented 5 years ago

I am not sure if this is a bug or a desired behaviour but links generated with

<a id="foo"></a>

are not working in any markdown preview I tried. Using name instead of id fixed the issue.

Odyseus commented 5 years ago

Hello, @batracos.

It isn't a bug. It was changed in response to this issue. In short, the name attribute is not supported for <a> tags in HTML5.

I use OmniMarkupPreviewer Sublime Text plugin to preview Markdown files and everything works as it should using the id attribute.

batracos commented 5 years ago

Thanks for replying (and let me use the occasion to say that this is an extremely useful package). I started looking into this issue also because anchors with id are not working on Bitbucket, while name it's fine. Unless you plan to expose this as an optional setting, I guess I can keep using a local modification—annoying but not exceedingly so.

Cheers

jonasbn commented 5 years ago

Hi @batracos and @Odyseus

Please if you have any information on compatibility issues like the one with Bitbucket, we are very interested in documenting this, since it can save people hours of hard work and grief.

Please see the limited information available at:

https://github.com/naokazuterada/MarkdownTOC#compatibility

Odyseus commented 5 years ago

Hello, everybody.

@batracos: The problem is with BitBucket itself. I have my repositories on GitLab, and most of them I have them mirrored to BitBucket and GitHub. The in-line links in my README files work perfectly in GitLab and in GitHub, but not on BitBucket.

Maybe you can try another alternative? Like the one in this StackOverflow answer. In short, do not create a TOC with MarkdownTOC, just add the string [TOC] at the beginning of the README and BitBucket will automatically generate the TOC. I didn't tested this.

@jonasbn: I guess that you could add BitBucket to the compatibility list (as not compatible).

jonasbn commented 5 years ago

@Odyseus I will update the documentation accordingly

@batracos can you provide some information on the Bitbucket version

batracos commented 5 years ago

@jonasbn we are on v5.12.2

@Odyseus unfortunately [TOC] does not work. Not sure why, I escalated the issue the site admins. For the time being I am a happy user of the custom MarkdownTOC =)

naokazuterada commented 5 years ago

Hi, sorry for long time no-response...

@batracos If you want to use name instead, please fork and replace these lines.

@Odyseus @jonasbn Thank you for the advice and comments!