DEV Community

Cover image for HTML to Markdown, and the heading anchors GitHub makes
Georgi Kalchev
Georgi Kalchev

Posted on Originally published at aiskills402.com

HTML to Markdown, and the heading anchors GitHub makes

Converting HTML to CommonMark without losing meaning, then writing a table of contents whose links land: how GitHub and GitLab turn headings into anchors.

Converting HTML to Markdown loses meaning in three places: an address that was retyped instead of copied, a character that Markdown reads as syntax at that spot, and an element Markdown has no word for. A table of contents then adds a fourth risk, a link aimed at an anchor that differs from the real one by a single character, which leads nowhere when followed and reports nothing. This guide walks through each break in the order a converter meets it, ending with how GitHub and GitLab build heading anchors and a check that can fail.

Read the full report on AISkills402: https://aiskills402.com/blog/html-to-markdown-and-heading-anchors?utm_source=devto&utm_medium=social

Top comments (0)