Change:
[X] Notebooks (.ipynb files) [ ] Interactive Window and/or Cell Scripts (.py files with #%% markers) Hello. As the title says, I can't make a internal link in a jupyter notebook in vscode if the cell's title starts with a capital letter, contains an underscore or contains a space, as you can see on the images. Also, on the sole option that it works, non-capital letter header, when clicked it brings me to the bottom of the notebook, and the focus is not brought on the right header itself. Initial tests: ! The test headers: ! 64.5 v2022.2. Python v3.8.5 Python Extension: v2022.2. No response Local
This is actually handled by VS code core (and not the extension). I've included a demo notebook that repros the problem .
In the demo notebook, the href jumps all work ! But none of the header jumps do unless you rewrite them to be only lowercase. All of the links work fine when running in 'jupyter'.
Vscode this notebook is still with all the bugs. Even on the links that work, they jump me to the very bottom of the notebook, not to cell 2, cell 3 or cell 4. Also Section jump and Section with space jump still doesn't work at all. I'm using portable Vscode btw, but I think this doesn't make any difference since when I was using the regular one this bug still existed. Even now, about 2 years later (that I recall) it still goes on on notebooks in Vscode. I can record a GIF if you need. I assure no weird magic was done on my vscode, just regular installation and all... and I can confirm that this issue still occurred years ago on my other PC too.
Does this reproduce in the ?
It did for me.
Will this issue be addressed on any new version of Vscode? I've headed to version 1.67 and to "April+2022+Recovery+2"+is%3Aclosed and found no mentions of this issue. Perhaps on the next, if it would be implemented/fixed at all? Thanks anyway! :)
This issue was fixed in 1.68 (the May 2022 milestone)
got a look at and pull request ( ) doesn't appear there. Will it be ? Thanks :)
Did you test it?
Yes! everything was fixed. Capital letters, underscore and space headers now work like a charm. I was just asking if this specific commit ( ) will be listed on the update website. I don't know how it works, if minor fixes won't get listed or something like that. I just wanted to show to some friends that somehow I've contributed to Vscode with my bug report Anyway, everything buggy was fixed. This issue may be closed anytime.

Discussion:
markdownIt.linkify.set({ fuzzyLink: false }); addNamedHeaderRendering(markdownIt); <ins> addLinkRenderer(markdownIt); </ins> const style = document.createElement('style'); style.textContent = `

const originalHeaderOpen = md.renderer.rules.heading_open; md.renderer.rules.heading_open = (tokens: MarkdownItToken[], idx: number, options, env, self) => { const title = tokens[idx + 1].children!.reduce<string>((acc, t) => acc + t.content, ''); <del> let slug = slugFromHeading(title); </del> <ins> let slug = slugify(title); </ins> if (slugCounter.has(slug)) { const count = slugCounter.get(slug)!; slugCounter.set(slug, count + 1); <del> slug = slugFromHeading(slug + '-' + (count + 1)); </del> <ins> slug = slugify(slug + '-' + (count + 1)); </ins> } else { slugCounter.set(slug, 0); }

}; } <del> function slugFromHeading(heading: string): string { </del> <ins> function addLinkRenderer(md: MarkdownIt): void { const original = md.renderer.rules.link_open; md.renderer.rules.link_open = (tokens: MarkdownItToken[], idx: number, options, env, self) => { const token = tokens[idx]; const href = token.attrGet('href'); if (typeof href === 'string' && href.startsWith('#')) { token.attrSet('href', '#' + slugify(href.slice(1))); } if (original) { return original(tokens, idx, options, env, self); } else { return self.renderToken(tokens, idx, options); } }; } function slugify(text: string): string { </ins> const slugifiedHeading = encodeURI( <del> heading.trim() </del> <ins> text.trim() </ins> .toLowerCase() .replace(/s+/g, '-') // Replace whitespace with - // allow-any-unicode-next-line