feat(docsite): check, caption and sync src= blocks in module READMEs (quick-261118-qsd)

- checkSnippets compares top-level src= fences of module READMEs like
  docs/ pages; the README src= refusal is gone
- Sync also rewrites drifted src= fences in modules/<name>/README.md,
  still all-or-nothing across pages and READMEs
- fenceAnnotator captions top-level src= fences on every page
- the snippet-readme-src planted violation now plants a drifted README
  fence instead of the old refusal
- utilities.md, README.md and CLAUDE.md describe src= in module READMEs
This commit is contained in:
Jakub Zych
2026-11-18 19:29:36 +01:00
parent 830f305376
commit 721830c502
10 changed files with 180 additions and 46 deletions

View File

@@ -59,10 +59,11 @@ func (fenceAnnotator) Transform(doc *ast.Document, reader text.Reader, pc parser
if !entering || !ok || fc.Info == nil {
return ast.WalkContinue, nil
}
// Captions only on the fences checkSnippets compares: top-level
// src= fences of docs/ pages. A nested or module README fence is
// not verified, so it must not claim a source.
verified := pctx != nil && pctx.page != nil && pctx.page.Module == "" &&
// Captions only on the fences checkSnippets compares: the
// top-level src= fences of every page, docs/ pages and module
// READMEs alike. A nested fence is refused, not verified, so it
// must not claim a source.
verified := pctx != nil && pctx.page != nil &&
fc.Parent() != nil && fc.Parent().Kind() == ast.KindDocument
if !verified {
return ast.WalkContinue, nil