The anchors of the website come from a Markdown extension of the blueprint¶
Context¶
.github/mkdocs-blueprint.yml gives the extension toc the slugify of pymdownx with case: lower, so that a heading has the anchor that GitHub gives it on the page of the file, and a link to it works in both places. That held for nearly every heading, but strip_tags() of toc ends with ' '.join(text.split()): every run of whitespace, a no-break space (U+00A0) and a narrow no-break space (U+202F) among it, reaches the slugify as one plain space (#1117).
- A no-break space, which French puts before
?,!,:and;: GitHub drops it, the website made it a hyphen. The 21 questions ofdocs/faq.fr.mdof homedarts-for-autodarts hadde-quoi-ai-je-besoin-on the website andde-quoi-ai-je-besoinon GitHub, so a link to one of them could pass either its test against GitHub's anchors or the strict build, never both. - Two spaces, also those that inline HTML such as
A <br> Bleaves: GitHub makes two hyphens, the website one. - An emoji shortcode: GitHub takes its name,
Emoji :dart: darthasemoji-dart-dart; the website dropped the emoji that pymdownx.emoji put in its place,emoji-dart.
No slugify can tell these apart, since it gets the text after the collapse. Decisions 0146 and 0166 take work out of the hooks of .github/mkdocs_blueprint.py, since Zensical runs no hook of MkDocs.
MkDocs imports the Markdown extensions while it reads its configuration, before it loads the hooks, and only by name: neither mkdocs build, whose script starts in the folder of the virtual environment, nor Zensical 0.1.1 finds a module beside mkdocs.yml or in .github/ (measured with both on 2026-11-23), and only python -m mkdocs has the current folder on the path of Python.
Options¶
- A slugify of its own: it still gets the collapsed text, so it can't drop a no-break space that has become a plain space.
{#id}on the headings, or another way to write the no-break space: GitHub shows{#id}as text, a plain space lets?wrap onto a line of its own, and every author of every page would have to remember it.- A hook that adds the extension in
on_config: it works with MkDocs, but it is lost with the move of 0146, and the anchors would quietly fall back to those oftocand move a second time. - The extension named in
markdown_extensions, found throughPYTHONPATHorpython -m mkdocs: every command that builds the website, the preview of a person among them, would have to remember it, and a plainmkdocs servewould stop with Failed to load extension. - The extension named in
markdown_extensions, with a tag of YAML as its configuration that puts.githubon the path of Python:github_anchors: !!python/object/apply:site.addsitedir [.github]. PyYAML runs the tag while MkDocs or Zensical reads the file, before either imports an extension, and the tag givesNone, which both take as an extension without options.
Decision¶
Option 5, since only it keeps the anchors in the place that both generators read, with no step that a build has to remember:
.github/github_anchors.pyis a Markdown extension of the blueprint beside the hooks, which every repository gets with the template and which.github/blueprint/owned.txtlists. Its treeprocessor runs at priority 6: afterattr_list(8), whose{#id}a heading keeps, and beforetoc(5) and the collection of anchors of MkDocs for its strict check at the same priority, so that the permalinks, the table of contents, the search and that check all take its ids.- It changes only the text that the slugify of
tocgets: the text of the heading astocreads it, with the escapes, entities and HTML resolved and the tags and comments removed, but with its whitespace as it is, and each emoji of pymdownx.emoji as the shortcode in its title. The slugify of the configuration makes the anchor, and a heading that has an id keeps it. - A repeated heading keeps
_1,_2, numbered astocnumbers it. GitHub writes-1,-2, and counts within the file thatpymdownx.snippetsincludes, the website within the page; numbering them as GitHub does would move ids that are stable today, so it is a decision of its own. - The tag puts the folder
.githubof the current folder on the path, aspymdownx.snippetstakes its files from there: every build of the blueprint starts in the root of the repository.site.addsitediradds it at the end of the path, so that no installed module is shadowed, and only once, also in each build ofmkdocs serve.
Consequences¶
- On a website in French, every heading with a no-break space gets a new id, the 21 questions of
fr/faq.htmlof homedarts-for-autodarts; their old ids stop working, and the fragment of the changelog says so. Every other id stays: the builds of the website of the blueprint (451 pages, 9,473 ids) and of homedarts-for-autodarts (302 pages, 8,879 ids) before and after differ only in those 21 ids. - Zensical 0.1.1 loads the extension from the same configuration and gives the same anchors, also for a link to another page that its check of the anchors accepts, so the move of 0146 carries the anchors without a step of its own.
- A website that builds from another folder than the root of its repository, with
mkdocs build -f, stops with Failed to load extension 'github_anchors', as its snippets would miss their files. - An icon of Material such as
:material-github:still counts with nothing, as before: its element carries no shortcode, and GitHub keeps such a name as text. - The tests render headings with the extensions of
.github/mkdocs-blueprint.ymland compare them with the anchors that GitHub's renderer gave, so the tools of development have Python-Markdown and pymdown-extensions as well.
De quoi ai-je besoin ?¶
This heading is the first question of the French FAQ of homedarts-for-autodarts ("What do I need?"), with the no-break space before its ?, and the page of the website links to it by the anchor that GitHub gives it, de-quoi-ai-je-besoin. Without the extension, the heading has de-quoi-ai-je-besoin-: should its ids ever stop reaching the check of the anchors of MkDocs or Zensical, such as when either collects them before priority 6, the strict build of this website fails on that link.