question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: markdown anchor links for a header with html

See original GitHub issue

Description

when creating a header with html

  • if there is an anchor tag then this should be used
  • or not use the text excerpt from the additional html

Steps to reproduce

this markdown:

**In this post:**
- [About the project](#about)
- [How it all began](#beginnings)
- [Assembling a team](#team)
- [Building a prototype](#prototype)
- [Get Involved](#help)

### About the project <a name="about"></a>

Expected result

  • a anchor link with about-the-project

Actual result

current status on https://www.gatsbyjs.org/blog/2020-03-26-service-relief-project/

  • the anchor links in the TOC are not working (to #about)
  • a anchor link is created with about-the-project-a-nameabouta
<h3 id="about-the-project-a-nameabouta" style="position:relative" class="css-0">
  <a aria-label="about the project a nameabouta permalink" class="anchor before css-0" href="#about-the-project-a-nameabouta">
    <svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16">
      <path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path>
    </svg>
  </a>
  About the project <a name="about" class="css-0"></a>
</h3>

Related Issues

  • #22548 (blog) service relief project
  • #19267 Add link checker for Gatsby Docs

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
piehcommented, Apr 2, 2020

This is likely related to autolink-headers scroll updates (it uses id only and not name)

Per http://w3c.github.io/html-reference/a.html#a-constraints

The name attribute on the a element is obsolete. Consider putting an id attribute on the nearest container instead.

So we probably won’t be fixing the plugin to handle name and instead will need to adjust blog post content - likely to just drop those custom <a> tags with names and use generated ids in table of content?

0reactions
mueschacommented, Apr 28, 2020

=> i close the issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Markdown links to header id anchor of another file doesn't ...
What is the current bug behavior? Link to header id anchor referred to 404 page because missing -/blob part in the generated url....
Read more >
Cross-reference (named anchor) in markdown - Stack Overflow
In Markdown Extra, the anchor ID is appended to a header or subhead with {#pookie} . Github Flavored Markdown in Git repository pages...
Read more >
Named Anchors & Markdown - DEV Community ‍ ‍
When writing longer files in Markdown, I find it useful to create links within the document to help readers navigate.
Read more >
Link to headers in markdown via anchor tags | Bitbucket Server
Yes! We need this and shouldn't be difficult to add? I'm using a jsdoc-to-markdown node plugin but it generates tons a <a> tags...
Read more >
424030 – Markdown: anchor links generate errors - Bugs
In your case where would the target of #anchor be defined? Markdown such as this should work without error: # Heading Text Link...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found