Skip to content

Lint text checks - #87

Merged
Andrew Turner (acturner) merged 11 commits into
release-1.11from
v111-s10
Nov 28, 2026
Merged

Andrew Turner (acturner) merged 11 commits into
release-1.11from
v111-s10

Conversation

@acturner

Copy link
Copy Markdown
Contributor

What changed

  • wiki lint reports a double-quoted name, title, desc or category whose value holds a control character: a C0 control (a tab and a line break included), DEL, U+0085, U+2028 or U+2029. YAML reads a backslash inside double quotes as an escape, so "$\frac{1}{2}$" holds a form feed, and wiki update copies it into the H1 and the parent index's row. The issue names the field, its line and each character once (U+000C (\f)), and says to write LaTeX in single quotes or a block scalar, or to double each backslash. Its kind in --json is control_character. The decoded value is what is judged, so a control character typed raw between the quotes is the same finding. An escape that decodes to text (é, \") is not reported.
  • wiki lint notes a control character in authored content: a page's body, or an index's text below ***. It covers the C0 controls other than a tab and a line break, and DEL. There is one note per file, with the first line and the count. Generated text (the H1, the link rows) is not scanned, and a no-lint region is skipped. It stays a note under lint.strict. Its kind in --json is content_control_character. When several files hold one, the CLI prints one count line for the kind.
  • wiki lint reports a name, title, desc or category whose YAML value is a mapping or a list, such as an indented Key: value line under a bare desc:. The issue names the field and its line, and says to quote the value or write it as a >- block. Its kind in --json is nonscalar_field. tags and sources are lists by design and are not judged.
  • For a bad backslash escape in a double-quoted value (an unknown escape character, a bad \x or \u number, a code that names no character), the invalid_yaml issue now gives the same quoting remedy. Every other parse error keeps "quote or rewrite the value". The reason for a bad number spells hexadecimal. The C loader and the pure-Python loader give the same line, reason and remedy, for an escape past U+10FFFF too.
  • format.read_frontmatter_field is not changed, and no written file changes.

The CHANGELOG lines are under Unreleased (Added and Fixed). docs/guide/generation.rst, docs/guide/pages.rst, docs/cli/index.rst, docs/recipes.rst, docs/guide/getting-started.rst and the skill describe the new findings.

Tests

  • desc: "Bound on $\nu$ and $\theta$ and $\frac12$." is one issue, on its own page, and lint exits 1. The same text in single quotes, in a >- block or with doubled backslashes is clean, and so are "café" and "say \"x\"".
  • Each of the four text fields is judged, in a page and in an index. A list field (tags) is not.
  • A tab typed raw inside double quotes, and a blank line there, draw the same issue.
  • A body with a form feed draws one note, exit 0, with the kind, the path, the line and the count in lint --json. Two such pages print one count line. The same byte inside a no-lint region draws nothing, and a parent index whose generated row holds the damage draws no second finding.
  • A nested mapping under desc:, a block list, a flow list and an empty flow mapping are each one issue, in a page and in an index.
  • title: "Uses \(p\) here", desc: "Uses $\xi$.", a lone surrogate escape and "\U00110000" get the quoting remedy on the escape's line.
  • The cases that depend on the YAML parser run under the C loader and the pure-Python loader.

pytest (3408 passed), pre-commit run --all-files and pyright parity tests/test_parity are clean. The docs build with sphinx-build -W.

YAML reads a backslash in double quotes as an escape, so LaTeX typed
there decodes to control characters: \theta opens with a tab, \nu with
a line break, \frac with a form feed. Update copies the value into the
H1 and the parent's row, and lint said nothing.

Lint now reports a double-quoted name, title, desc or category that
holds a C0 control, DEL, U+0085, U+2028 or U+2029. The issue names the
field, its line and each character, and gives the remedy. The
generated copies are not scanned, so the finding stands once, on the
file that holds the field. An escape that decodes to text is not
reported.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A form feed in a page body is what is left of \frac once a tool decoded
\f on the way in, and lint did not look at body text for it.

Lint now notes a C0 control other than a tab or a line break, or DEL,
in a page's body and in an index's text below the delimiter: one note
per file, with the first line, its character and the count. Code is
scanned too. The H1 and the link rows are generated from frontmatter
fields, so they are not scanned and the damage is reported on the file
that holds the field. A no-lint region is skipped, and lint.strict does
not make the note an issue.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
An indented Key: value line under a bare desc: nests a mapping, and
title: [Draft] is a list. The block is valid YAML, so lint was silent:
update wrote the field's source lines into the H1 and the parent's row
while every strict reader handed other tools a collection.

Lint now reports a name, title, desc or category whose value is a
mapping or a list. The issue names the field and its line, and says to
quote the value or write it as a >- block. tags and sources are lists
by design and are not judged.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A double-quoted value with a backslash YAML cannot decode, such as
"Uses \(p\) here" or "Uses $\xi$.", is a parse error, and lint advised
"quote or rewrite the value" for a value that was quoted already.

The strict reader's findings gain an escape cause: an unknown escape
character, a bad \x or \u number, or a code that names no character.
Lint says for it that a backslash starts an escape inside double
quotes, and to write LaTeX in single quotes or a block scalar, or to
double each backslash. Every other parse error keeps its advice.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
libyaml words a bad \x or \u number in a double-quoted value as "did
not find expected hexdecimal number", and lint printed the reason as it
came. The word is rewritten where the reason is worded, so the issue
reads "hexadecimal" under either loader.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The merge is clean. The CHANGELOG's Unreleased section keeps both
sides' lines.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The description section of the pages guide said lint does not report an
indented Key: value line under a bare desc: key. Lint reports it as a
nonscalar_field issue, as the frontmatter section of the same page
says.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Lint checks a text field for a mapping or a list in a folder index as
it does in a page, and the test wrote the field only into a page. It
now runs for both, so the index-side check is pinned.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A double-quoted "\U00110000" names no character. The C loader rejects
it as an invalid escape, and lint gives the quoting remedy on the
escape's line. The pure-Python loader raises a bare ValueError from
chr() instead, with no position, so the same value drew "quote or
rewrite the value" on line 1 with the reason "ValueError".

The reader now scans the body again when the pure loader raises that
error, takes the line its scanner stopped on, and words the finding as
the C loader does. A ValueError raised anywhere else keeps its report.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Lint judges the decoded value of a double-quoted text field, so a tab
typed raw between the quotes, or the line break a blank line inside a
multi-line value folds to, is reported with the backslash advice. The
generation guide now says so, and the test holds the case.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant