Markdown gives the ease of writing in a simple, easy-to-read, and easy-to-write plain text format. This tutorial targets software engineers and other technical professionals learning about Markdown and will delve into how to link to a section within the same document - a very useful tool when creating lengthy Markdown documents.

Each section is categorized under different headers (h2 and h3), and corresponding code snippets are included. The explanation of why and how the code works is also provided. This tutorial will specifically use Github-Flavored Markdown for the examples.


To make the most of this tutorial, you’ll want basic familiarity with Markdown syntax.


Table of Contents:

Creating Headers

In Markdown, Headers are created by using the pound sign (#). A single pound sign (#) creates an h1 header and increasing the number of pound signs escalates the header level accordingly.

Generally, it’s standard practice to skip h1 headers in Readme files as Github automatically provides one.

Here’s an example of how different levels of headers look in Github-Flavored Markdown:

## H2 Header
### H3 Header
#### H4 Header
##### H5 Header
###### H6 Header

This will render as below:

H2 Header
H3 Header
H4 Header
H5 Header
H6 Header

Now, let’s move onto how to create the links.

Header links are created by using the link syntax in Markdown. The label is enclosed in brackets ([]), followed by the URL in parentheses (()). Here, the URL is replaced with the header to link to.

[Link to H2 Header](#h2-header)
[Link to H3 Header](#h3-header)

When you click on these links, you will be redirected to the section of corresponding headers.

Any spaces in the header will be replaced by a dash (-) in the URL.

Additionally, all the text will be converted to lowercase, and any special characters except alphanumeric and dash (-) will be ignored in the URL.

Consider the following example:

### This is a test header.

Could be linked as follows:

[Link to test header](#this-is-a-test-header)

Additional Notes

It’s essential to note that Github automatically adds these links to all of your headers by default. These are automatically generated based on the header text according to the rules stated above.

If you want to get a link to a section, right-click on the section title and select ‘Copy Link Address.’


Now you have a basic understanding of interlinking different sections inside a Markdown file. Interlinking will extensively improve the readability of your lengthy documents, making navigation effortless.

Keep practicing, and for further references, you may refer to the official Github Flavored Markdown Guide.