Repository navigation
Keep the text of a published link that leaves the blueprint - #318
Merged
Merged
Conversation
The site holds only the blueprint. When readers cannot be sent to the repository, render keeps source notes in the site, and their evidence links to Lean files beside the blueprint were left pointing outside it: dead links, which MkDocs reports as missing, so a strict build failed. Large blueprints such as Formal-Math's and ATLAS's carry thousands. Render now replaces an inline link whose target lies outside the blueprint with its text. A reference-style definition is left as it was. This supersedes #299, which excluded `sources/**` from MkDocs instead. That changed nothing in a verified Pages build, where render already leaves source notes out, and in every other mode turned the published notes' `## Sources` links into 404s that a strict build reports only at INFO. The bundled example's source map now cites the Lean file that holds `CabannesThesis.supervision`. `make check-example` renders the example in this mode, since its Lean root is a subdirectory of the repository, and builds it with `--strict`, which failed on that link before.
Contributor
Author
|
This is the evidence for the end-to-end check in the description. Main with only the new line in the example's source map, and without the render change, fails https://github.com/facebookresearch/autoform-bot/actions/runs/38618403157 Posted by PR swarm: PR Swarm Lead |
Deicyde
marked this pull request as ready for review
October 14, 2026 19:32
This was referenced Oct 14, 2026
Deicyde
added a commit
that referenced
this pull request
Oct 15, 2026
#318 replaces a published link that leaves the blueprint with its text. This branch's link pattern lets a match start at an earlier "[" on the line, so a line such as "On $[0,1]$ see [Basic.lean](...)" lost the interval's bracket and kept the link's. The replacement now drops only the bracket that opens the link, and #318's test covers a bracket before it.
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.
Supersedes #299. I did this at the user's request (2026-10-14), after reviewing #299: #299 (comment)
Problem
The site holds only the blueprint. When
rendercannot send readers to the repository, it keeps source notes in the site:make check-example's layout;Their evidence links to Lean files beside the blueprint, such as
[Basic.lean](../../src/CabannesThesis/Basic.lean#L5), were left pointing outside the blueprint. Those are dead links, and MkDocs reports each one as missing (... is not found among documentation files), somkdocs build --strictfails. #299 describes large blueprints such as Formal-Math's and ATLAS's carrying thousands of these links.#299 excluded
sources/**from MkDocs instead:## Sourceslinks into 404s, which MkDocs 1.6 logs only at INFO.Change
_rewrite_linksnow replaces an inline link whose resolved target lies outside the blueprint with its label. For example, the link above becomesBasic.lean. This applies to every published page; articles cannot hold such links anyway, becausecheckandauditrefuse a## Sourceslink that leaves the blueprint. Links inside the blueprint, URLs, absolute paths and fragment-only links are unchanged. A reference-style definition that leaves the blueprint is left as it was.Tests
test_a_published_link_out_of_the_blueprint_keeps_only_its_text(tests/test_render.py): a published source note with links to a Lean file and to a directory outside the blueprint, and a link to an article. The outside links keep only their text; the article link is still rewritten. The test fails if the change is reverted.CabannesThesis.supervision.make check-example(in CI's test job) renders the example in this mode and runsmkdocs build --strict, so it now covers this path end to end. A scratch run of main plus only that line shows the strict build failing on the link; the run is linked in a comment below.Overlap
Trial merges against #90, #213-#219, #284, #300, #301 and #307 add no conflicts beyond what each already has with main.
This machine is over the agreed load limit for local pytest runs. The new test and its neighbours were called directly in Python, and CI on this PR is the full run.