fix(11.1-07): check go fences, README src= and shell fences from the AST

- goLang follows the highlighter's chroma lookup, so golang and main.go need src=
- a src= fence in a module README is refused and never captioned
- shell fences inside callouts and lists are command-checked
- a fence with four or more leading spaces is an indented code block
This commit is contained in:
Jakub Zych
2026-10-01 08:30:19 +02:00
parent 5b7e37fb69
commit 73c72af244
8 changed files with 88 additions and 49 deletions

View File

@@ -86,18 +86,16 @@ func (s *site) checkCommands(docs []parsedDoc) ([]Problem, error) {
for _, span := range codeSpans(d.doc, d.body, d.line) {
check(d, span.line, span.text)
}
lines := strings.Split(string(d.body), "\n")
for _, f := range scanFences(lines) {
lang, _, _ := strings.Cut(f.info, " ")
if !slices.Contains(shellLangs, lang) {
fences, err := collectFences(d.doc, d.body)
if err != nil {
return nil, err
}
for _, f := range fences {
if !slices.Contains(shellLangs, f.lang) {
continue
}
end := f.close
if end < 0 {
end = len(lines)
}
for i := f.open + 1; i < end; i++ {
check(d, d.line+i, lines[i])
for _, line := range f.code {
check(d, d.line+line.line, line.text)
}
}
}