parseAnchors doesn't generate anchors with inline math correctly
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 106
- Forks
- 223
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 72
Description
When a heading contains inline math, our parseAnchors logic is not able to generate the correct anchor for it.
For example, the following heading gets parsed as #template-circuits-for-calculating-matrix-elements-of-$tilde{s}$-and-$tilde{h}$-via-hadamard-test rather than #template-circuits-for-calculating-matrix-elements-of-tildes-and-tildeh-via-hadamard-test:
This also affects to our translations. We are using this same logic to generate the English anchors even in a translated pages to avoid breaking the links.
Example of the link checker output when you try to link to that title:
Checking internal links for non-API docs
❌ Could not find link '/docs/tutorials/krylov-quantum-diagonalization#template-circuits-for-calculating-matrix-elements-of-tildes-and-tildeh-via-hadamard-test'. Appears in:
docs/guides/index.mdx ❓ Did you mean '/docs/tutorials/krylov-quantum-diagonalization#template-circuits-for-calculating-matrix-elements-of-$tilde{s}$-and-$tilde{h}$-via-hadamard-test'?
Some links appear broken 💔
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in scripts/js/lib/links/extractLinks.ts at parseAnchors and compare the generated anchor with the heading example in the issue. Check the link checker output for the expected anchor without the inline math delimiters, including the translated-page behavior. Done means headings containing inline math produce the expected anchor and the documented link checker example no longer reports the link as broken.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- latex, typescript
- Domain
- documentation, tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100