How to use the markdown link extractor
- Paste the Markdown text.
- Read the number of links, how many addresses are different and how many are used more than once.
- Check the table for each link with its line number, kind, text and address.
- Copy the list or download it as a CSV file to work on in a spreadsheet.
Formula
Inline links: [text](address) with an optional title
Reference links: [text][id] or [text][] or [text], matched with a definition line [id]: address
Autolinks in angle brackets and plain web addresses that start with http or https
Links inside fenced code blocks and code spans are skipped, and so are images.
A short note with mixed links
The sample note has 7 links: three inline, two with the same guide address, one reference link to the FAQ, an autolink, a plain address and one broken reference. There are 5 different addresses and 1 of them is used more than once.
The table marks the second use of the guide address as a duplicate, flags the inline link with no text as empty, and flags the reference called nope as having no definition. Those three marks are the ones to fix before publishing.
Why list the links
Before you publish a page or a README, it helps to see every link in one place. A list shows addresses that are repeated, links with no visible text, references that point nowhere and links that use plain http. You can paste the addresses into a link checker, compare them with a sitemap, or hand them to a reviewer.
Line numbers let you jump straight to the spot in your editor. Because the tool ignores code blocks and code spans, an example link written in a tutorial does not show up as a real one.
What it does not do
The tool reads common Markdown. It does not follow every rule of the full specification, and it does not recognize links inside indented code blocks. It also does not visit the addresses, so it cannot say whether a page exists. For a table of contents from the headings use the Markdown TOC Generator, and for links in a PDF the PDF Link Extractor. To see how the page renders try the Markdown Editor and Previewer, and to tidy a plain list of addresses the URL List Cleaner.
Assumptions and limits
- The text is written in common Markdown with web style links.
- Reference ids match without regard to upper or lower case.
- The sample note is an example. Use your own text.
- Everything is processed in your browser and nothing is uploaded.
Frequently asked questions
Are images counted as links?
No. An image such as an exclamation mark followed by brackets is skipped. Only links that a reader can click are listed.
What counts as a duplicate?
An address that appears in more than one link. The text of the links may differ, and each use after the first is marked.
Why is a reference marked as having no definition?
The text uses an id that no definition line provides, so the reader would see raw brackets instead of a link.
Can I get the result in a spreadsheet?
Yes. Download the CSV, which has one row per link with the line, kind, text, address and notes.