DEV Community

Cover image for TIL: Visual Studio Code does markdown autocompletion for in-page links
Christian Heilmann
Christian Heilmann

Posted on • Originally published at christianheilmann.com

TIL: Visual Studio Code does markdown autocompletion for in-page links

When you write markdown files, headings automatically also get an ID generated so they become in-page targets to link to. This is also used to create a table of contents in various publishing systems.

This means

## Side effects of 24 hour compound V
Enter fullscreen mode Exit fullscreen mode

becomes

<h2 id="side-effects-of-24-hour-compound-V">
  Side effects of 24 hour compound V
</h2>
Enter fullscreen mode Exit fullscreen mode

Today I learned that VS Code also offers these generated IDs as an autocomplete when you type links. If you wrap the word you want to link in square brackets and you add the parenthesis to type the target the link should point to starting this one with a # will offer all the possible target IDs in the current document.

Visual Studio Code offering a list of all the generated IDs of headings for in-page links

Neat!

Top comments (0)