docs: record why the logo artwork exists twice and why overrides/ is a root folder - #199
Merged
Merged
Conversation
…a root folder overrides/ holds exactly one file, an SVG that duplicates most of docs/assets/logo.svg, and neither the folder's existence nor the duplication is self-evident from looking at either file. Both are deliberate: Material resolves a custom icon namespace from <custom_dir>/.icons/<namespace>/<name>.svg, which is the only reason custom_dir is set at all, and custom_dir has to be a sibling of docs/ rather than inside it, because anything under docs/ is also copied verbatim into the built site. Verified: docs/assets/logo.svg appears at site/assets/logo.svg, while the icon is inlined into the page markup and the string "heart-rise" never reaches the output. The two copies are not redundant. The icon is inlined, so it uses currentColor and follows the header, which flips between white and black with the palette. A favicon is rendered by the browser outside the page, where currentColor has nothing to resolve against, so that copy bakes its colours in and carries its own prefers-color-scheme rule. What is a real hazard is that nothing keeps the two in step: changing the logo means editing both files and no test or build step notices if only one changes. The comment goes in mkdocs.yml rather than in the SVGs because that is the one place both are referenced, and because a comment inside the icon would be inlined into every page. Also adds `prune overrides` to MANIFEST.in. It was already absent from the 0.7.1 sdist, but by setuptools default behaviour rather than by declaration; the prune list enumerates the other development directories and this one was the gap. Confirmed still absent from a freshly built sdist afterwards. No behaviour change. `mkdocs build --strict` exits 0 and the logo is still inlined.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Docs-and-packaging only. No source change, no behaviour change.
Why
overrides/is a separate root folderIt has to be.
theme.custom_diris the only mechanism Material offers for registering a custom icon namespace, and it resolves them from<custom_dir>/.icons/<namespace>/<name>.svg. That path is whaticon.logo: philanthropy/heart-risepoints at.custom_diralso cannot live insidedocs/, because MkDocs copies every non-Markdown file underdocs_dirverbatim into the built site, so nesting it would publish the icon at a stray URL.Both halves verified against the current build rather than assumed:
docs/assets/logo.svgis copied through tosite/assets/logo.svg, which is the behaviour that rules out nesting.ph-cutmask id appears inindex.html) and the stringheart-riseappears nowhere insite/.So the folder is the canonical Material layout and should stay where it is.
Why the artwork exists twice
The two SVGs are not redundant, they use different mechanisms:
currentColorand follows the header. The palette flipsprimarybetweenwhiteandblack, so a fixed-colour logo would be wrong in one of the two modes.currentColorhas nothing to resolve against, so it bakes its colours in and carries its ownprefers-color-schemerule.The actual defect this fixes
Nothing keeps the two copies in step. Changing the logo means editing both files, and no test or build step notices if only one changes. This adds the explanation to
mkdocs.yml, which is the single place both assets are wired up, and not to the SVGs themselves, because a comment inside the icon would be inlined into every page.One packaging gap
MANIFEST.inprunestests,docs,site,scripts,.githuband.hypothesis, but notoverrides. It was already absent from the 0.7.1 sdist, but through setuptools' default behaviour rather than through the declaration that is supposed to express it.prune overridescloses the gap.Verification