"Markdown" files are becoming a primary format for "AI enabled coding" workflows.
Also for documenting what is done.
Usually there are many files, some could be large, so being able to reference to part of the file is useful.
Since Markdown is based on HTML, anchor tags are supported, and even easier to use.
Learn how Markdown Links work. Welcome to the world of Markdown Links… | by Jochen Gererstorfer | inhalt | Medium
html - How to set an anchor in Markdown File - Stack Overflow
Named Anchors & Markdown - DEV Community
AI Overview
Anchor tags in Markdown allow you to link directly to a specific section within another file by combining the file path with a heading ID (anchor).
How it Works
- Identify the Anchor: Most Markdown renderers (like GitHub or VS Code) automatically generate anchors for headings by converting the text to lowercase and replacing spaces with hyphens.
- Combine Path and Anchor: To link to a section in a different file, use the format:
[Link Text](path/to/file.md#anchor-name)
Assume you have two files in the same folder:
README.md and setup.md.In
setup.md:The auto-generated anchor for the heading above is
#step-2-configuration.In
To link to that specific section from your main file:
README.md:To link to that specific section from your main file:
Advanced Usage
- Custom Anchors: If your renderer doesn't auto-generate IDs or you want a shorter link, you can manually insert an HTML anchor tag before a heading:
<a id="custom-id"></a>. Link to it usingsetup.md#custom-id. - Case Sensitivity: Most platforms require the anchor part (after the
#) to be all lowercase. - Special Characters: Punctuation in headings is typically ignored when generating the ID (e.g.,
## Setup!becomes#setup)
No comments:
Post a Comment