1. Bitbucket
  2. Public Issue Tracker
  3. master
  4. Issues

Issues

Issue #6322 duplicate

Anchor Links in markdown

Sugendran Ganess
created an issue

Markdown links to anchor tags don't get rendered as links, and the inline-html tags don't get rendered as HTML

e.g. https://bitbucket.org/sparkintl/spark.org.au/src/8e8a4a6a43bb/doc/directory-structure.md

I expect it to work like this: http://stackoverflow.com/a/6494918/22466

Comments (58)

  1. WowWee HK

    This is not a duplicate! it's about creating anchor links in Markdown (which require an HTML tag), it's not about generally supporting an HTML website.

    The issue posted is about fully supporting HTML.

  2. Thomas Neirynck

    I would agree with WowWee.

    Simple anchor tag support would go a long way to help people find info in longer markdown documents, without the need for full-blown html support.

    For example:

    Markdown: <a id="Anchor"></a>

    HTML: <p>&lt;a id="Anchor"&gt;&lt;/a&gt;</p>

  3. Branko Vukelic

    It's a generally accepted notion that you can insert anchors in Markdown simply because there are very widely used implementations that support this, and because there is simply no better way to do it. Sticking to what Python-Markdown guys say is not solving the problem of not being able to insert anchors.

  4. Ben Madore

    This certainly isn't necessarily a duplicate. Not sure why they felt the need to mark it as such. But, i can't say i have any hope of them ever implementing.

  5. Raf Gemmail

    +1 for supporting anchors. Further more, I encourage targeting github compatibility. When migrating a project from github to bitbucket, having to faf with a broken README.md is a real time waste.

  6. Branko Vukelic

    It has to be mentioned that insertion of HTML (and thus also anchors) is a documented feature.

    For any markup that is not covered by Markdown’s syntax, you simply use HTML itself. There’s no need to preface it or delimit it to indicate that you’re switching from Markdown to HTML; you just use the tags.

    and further below:

    If you want, you can even use HTML tags instead of Markdown formatting; e.g. if you’d prefer to use HTML <a> or <img> tags instead of Markdown’s link or image syntax, go right ahead.

    http://daringfireball.net/projects/markdown/syntax#html

  7. Centrify PS Team

    Running in the same issue here and opted to switch to Creole in the hope anchors would be supported. But they are not either. Also the macro <<TableOfContents()>> which is available in Creole and would simplify my life for creating easy to read WiKi pages seems not better supported and result in being completely ignored. Will go with the scroll-down-a-lot method for now but I am disappointed in not having so basic feature than anchors supported.

  8. Branko Vukelic

    One example use case:

    For more information, please see [Other section](#other-section).
    
    ## <a id="other-section">Other section</a>
    

    For this specific purpose, auto-generating the anchors would also work, but then it would be harder to predict the ID.

  9. Branko Vukelic

    Come to think of it this may be a good solution to avoid inserting HTML altogether:

    For more information, please see [Other section](#Other section) <-- reference verbatim
    

    The processor could detect when target URL is a fragment identifier only, and convert it to appropriate ID the same way it does the anchors for the headings.

    EDIT: This still won't take care of documents that are being migrated from other services where anchors are supported.

  10. Centrify PS Team

    Except that this doesn't work. The <a> tag is not parsed and appears as your header. They claim to support Markdown and are prompt to reference daringfireball but still as long as the HTML is not parsed on Bitbucket side it would be inefficient.

  11. Centrify PS Team

    @joaonvfigueiredo this is awesome, thanks for sharing! Note that if you use spaces in your header then replace them with - and use lower case.

    For more information, please see [this section](#markdown-header-that-section)
    ## That section
    
  12. M. Emre TÜRE

    I'd really appreciate a universal solution for anchors that will be rendered in the same way in all markdown editors and viewers. markdown-header- prefix seems bitbucket specific. The example of Branko Vukelic is much better. name attribute can also be used instead of id.

  13. Zhuohuan LI

    +1.

    I need anchor too.

    the solution for me is to put a [TOC] in my wiki, then I could get a link with anchor.

    not clean, but usable.

    hope bitbucket could support anchor like github.

  14. Danilo Vaz

    Ashamed that they have not yet implemented it. The Github makes this a long time and write documentation for the projects on Github is a thousand times better than bitbucket.

  15. A K

    +1 really need anchor support. The method proposed by João Figueiredo

    1) does not work in languages ​​other than English. Аn example of the generated ID:

    id=#markdown-header-_6
    

    2) specific for this service only

  16. Aaron Scott-Boddendijk

    I'm currently glad that most of my organisations projects are in Gitlab.

    Amazed Bitbucket hasn't managed to respond positively on this in three years - almost every other application of markdown I've encountered has a way of embedding anchors to assist with navigation within pages.

  17. Patrick Connolly

    Wow. I can't help but think that bitbucket developers are not even using their own platform. Anchors are useful for linked references to notes in bottom of documents. Each note cannot be given a header, just to try to get an anchor.

    Please consider adding this and removing whatever barrier seems to be making this so hard to implement (ie. package perhaps maintained by dogmatic maintainer)

  18. Mathias Kools

    +1 Support for anchors. I like to mirror documentation repos here on bitbucket along with github. I will still have ugly floating <a> anchor tags in my headings if I use the markdown-header solution.

  19. Petr Studený

    Hey, pls support this. I'd like to use the syntax [This is Header][]. This way the MD parser can create the cross-reference using the same function as id of the link.

  20. Benjamin Dobell

    Tony Archer Ah, no. This issue is marked as a duplicate of #3538, not #6930, and for good reason too. #3538 is specifically with regards to safe HTML, #6930 is incredibly vague.

    On the other hand, people keep commenting here and up-voting this issue not because they don't know about the other issues, but because they don't care about all HTML support. This issue is specifically about anchor support, in particular it's required to create an index of same page links. Most users simply don't care about supporting the entire HTML spec - in fact, I think that sounds like a terrible idea.

  21. Tony Archer

    Benjamin Echols I agree with you, but as you can see this issue is flagged duplicate, and therefore isn't being looked at by anyone with any power to do anything about anything. If you can find the thread that is open for a specific issue, please let me know. (I have no control over this ticket's state)

  22. Log in to comment