Skip to content

Instantly share code, notes, and snippets.

@asabaylus
Created July 8, 2012 14:12
Show Gist options
  • Save asabaylus/3071099 to your computer and use it in GitHub Desktop.
Save asabaylus/3071099 to your computer and use it in GitHub Desktop.
Github Markdown Heading Anchors

Anchors in Markdown

To create an anchor to a heading in github flavored markdown. Add - characters between each word in the heading and wrap the value in parens (#some-markdown-heading) so your link should look like so:

[create an anchor](#anchors-in-markdown)

@Ricky4K
Copy link

Ricky4K commented Jul 10, 2024

Is there any way to cross reference to another files header?

For example:

File1 contains

# Title
## Description
Lorem Ipsum

File2 contains

# Data
Click here to see the Description from File 1: [Information](../File1#Description)

@Ricky4K
Copy link

Ricky4K commented Jul 10, 2024

Is there any way to cross reference to another files header?

For example:

File 1 contains

# Title
## Description
Lorem Ipsum

File2 contains

# Data
Click here to see the Description from File 1: [Information](../File1#Description)

Looks like it does work like that however keep in mind if you have special Characters as a File name (at least for me) it did not properly show up in VSC. However after just pasting it in manually and clicking it via the preview it should work out just fine. Note the %20 stands for a blank space character here.

For example:

File 1 contains

# Title
## Description
Lorem Ipsum

File2 contains

# Data
Click here to see the Description from File 1: [Information](../File%201#Description)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment