Markdown: Markdown Link Syntax and Reference Links
Links are the backbone of the internet—in Markdown, a single syntax connects your document to the entire world.
1. What You'll Learn
- Inline link and reference link syntax
- Using relative links in GitHub projects
- Auto links and email links
- Navigating within a document with anchor links
- Link best practices and SEO optimization
2. A Documentation Engineer's Real Story
(1) Pain Point: Broken Links Leave Users Lost
Emma is a documentation engineer at a SaaS company. She discovered that roughly 15% of links in the help docs were broken—some because filenames had changed, others because external sites had migrated. Users reported "clicking links leads to 404 pages." Worse, some links were scattered across dozens of Markdown files, taking days to fix.
(2) Solution: Use Relative Links and Reference Links
Emma established link standards: all internal links use relative paths (domain-independent), and frequently-used links are defined in a reference section at the bottom of each document (one change applies everywhere). She also wrote a script to periodically scan all links for validity. Three months later, the link breakage rate dropped from 15% to 0.5%.
3. Inline Links
Inline links are the most common link format in Markdown, with intuitive syntax:
[Display Text](URL)
[Visit GitHub](https://github.com)
| Part | Description | Example |
|---|---|---|
[Display Text] |
The clickable text users see | [Visit Website] |
(URL) |
The target URL | (https://example.com) |
(1) Adding a Title Attribute
You can add an optional title attribute after the URL (displayed on hover):
[Google](https://google.com "Visit Google Search")
[MDN Docs](https://developer.mozilla.org "Comprehensive Web Technology Documentation")
▶ Example: Different Types of External Links
- [Google](https://google.com) — Search engine
- [GitHub](https://github.com "The world's largest code hosting platform") — Code hosting
- [MDN Web Docs](https://developer.mozilla.org) — Web technology documentation
(1) Three Ways to Define Reference Links
Method 1 (most common, with brackets):
[google]: https://google.com
Method 2 (shorthand without brackets):
Google: https://google.com
Method 3 (implicit link ID, auto-matches):
[Google][]
...
[Google]: https://google.com
[Google][] auto-use the bracket text as the ID, looking up the [Google]: definition. This is convenient when link text and ID are the same.
▶ Example: Full Reference Link Usage
## Recommended Resources
For web development, check out [MDN][] and [W3Schools][].
For code hosting, try [GitHub][]; for Q&A, visit [Stack Overflow][].
## References
- [MDN][]'s CSS documentation is comprehensive
- [Stack Overflow][] has tons of frontend Q&A
[MDN]: https://developer.mozilla.org/en-US/
[W3Schools]: https://www.w3schools.com/
[GitHub]: https://github.com
[Stack Overflow]: https://stackoverflow.com/
5. Relative Links
In GitHub projects or local docs, use relative paths to link to other files within the same project:
Project Documentation:
Installation Guide → installation.md
API Reference → api/overview.md
FAQ → faq.md
Previous Section → chapter-1/intro.md
▶ Example: Link Structure in a GitHub Project
Awesome Project
Quick Start: See docs/installation.md
Contribution Guide: Check CONTRIBUTING.md
Related Projects: Core Library (packages/core/README.md)
CLI Tool (packages/cli/README.md)
6. Auto Links and Email Links
(1) Auto Links
Wrap a URL or email address in <>, and Markdown will automatically generate a link:
<https://example.com>
<user@example.com>
(2) Disabling Auto Links
In some cases you want to display a URL without making it clickable—use code formatting or escaping:
`https://example.com` (displayed as code, not clickable)
Or:
\*\*https://example.com\*\* displays the URL as plain text
▶ Example: Auto Link vs Plain Text URL
Auto link: <https://www.google.com>
Plain text (no auto-link): https://www.google.com
Link with text: [Visit Google](https://www.google.com)
http:// or https:// and generate links even without <>. But in standard Markdown, using <> is the explicit approach.
7. Anchor Links (In-Page Navigation)
Anchor links let users click to jump to a specific location on the same page:
## Table of Contents
- [Introduction](#1-introduction)
- [Installation](#2-installation)
- [Configuration](#3-configuration)
---
## 1. Introduction
...
Jump to [Back to Top](#table-of-contents)
# portion of the rendered page URL to confirm the actual anchor value.
▶ Example: Table of Contents with Anchor Links
# Python Tutorial
## Table of Contents
- [Installing Python](#1-installing-python)
- [First Program](#2-first-program)
- [FAQ](#faq)
---
## 1. Installing Python
...
## 2. First Program
...
## ❓ FAQ
...
8. Complete Example: A Document Link Network
# Web Development Learning Path
## Frontend Basics
| Technology | Documentation | Description |
|:-----|:-----|:-----|
| HTML | [MDN HTML][mdn-html] | Web structure |
| CSS | [MDN CSS][mdn-css] | Web styling |
| JS | [MDN JS][mdn-js] | Interactivity |
## Hands-On Projects
Refer to the [Project Template][repo] to start your first website.
## Related Content
- Check [Internal Notes](notes/frontend-roadmap)
- Join the [Community Forum][forum]
- Contact: <author@example.com>
[mdn-html]: https://developer.mozilla.org/en-US/docs/Web/HTML
[mdn-css]: https://developer.mozilla.org/en-US/docs/Web/CSS
[mdn-js]: https://developer.mozilla.org/en-US/docs/Web/JavaScript
[repo]: https://github.com/example/web-starter
[forum]: https://community.example.com
Expected result: A well-structured documentation page combining inline links, reference links, table links, and email links into a complete learning resource network.
❓ FAQ
target="_blank". You need to use HTML: <a href="url" target="_blank">Text</a>.[](link url) to make clicking an image navigate to a URL.📖 Summary
- Inline links:
[text](url), most common and intuitive - Reference links:
[text][id]+[id]: url, centralized management - Relative links: use relative paths within the same project, migration-friendly
- Auto links:
<url>or<email>auto-generates clickable links - Anchor links:
#headingjumps to a specific spot on the page - Keep link text descriptive to improve accessibility and SEO
📝 Exercises
-
Basic: Write a short article using inline links with at least 3 external references (e.g., recommend your 3 most-used online tools).
-
Intermediate: Rewrite the above exercise using reference links. Then create a short GitHub project and use relative links to guide users from README.md to sub-pages under
docs/. -
Challenge: Write a "Learning Resources Hub" document that combines inline links, reference links (at least 5), anchor links for table-of-contents navigation, and an email auto-link
<user@example.com>at the bottom.