diff --git a/.agents/skills/comment-and-doc-style/SKILL.md b/.agents/skills/comment-and-doc-style/SKILL.md index 5650699fa..32a75bb06 100644 --- a/.agents/skills/comment-and-doc-style/SKILL.md +++ b/.agents/skills/comment-and-doc-style/SKILL.md @@ -291,7 +291,7 @@ It is also because reading those would report a fixture rather than a claim abou Agent-authored text is ASCII by default: documentation, code, comments, commit messages, and PR descriptions. A non-ASCII character is read against the tiers below, because whether one is typography or meaning depends on where it sits. A character in no tier is a finding rather than a -silent pass, a letter of a recorded name excepted per the bullet below. +silent pass. A letter of a recorded name and quoted data are excepted, per the bullets below. - **Tier 1, never legitimate.** Typography carrying no meaning its ASCII form loses. Remove on sight: @@ -324,12 +324,17 @@ silent pass, a letter of a recorded name excepted per the bullet below. document records as data is written with its own letters and the marks they carry. The reason is that folding such a name to ASCII records a different name. Anywhere else a letter the agent writes that no tier covers takes its ASCII form. +- **A Markdown code span is quoted data, as a fenced block is.** A string quoted verbatim from + another source, such as a third party's output, keeps its bytes inside an inline code span. No + tier judges it there. Outside Markdown a backtick is structural, so a code line is read whole. - **An unrecognized non-ASCII character is reported, not allowed.** Classify it into a tier above - before using it. A letter of a recorded name is the one exception, per the bullet above. + before using it. A letter of a recorded name and quoted data are the exceptions, per the bullets + above. - **No semicolon in agent-authored prose.** Recast a mid-sentence semicolon as a comma or as two sentences. A semicolon separating items in a list that already contains commas, or a statement terminator in code, is unaffected. A single semicolon separates such a list only between two labeled items, as in `Inputs: a, b; outputs: c`, and a list item's bold opening label is not one. + A semicolon inside one token, such as `TL;DR`, joins no clause and is unaffected too. - **No spaced hyphen joining or interrupting a sentence** (` - `, or the paired aside ` - x - `). Recast as a comma, two sentences, or parentheses. A hyphen inside a compound word, a leading list marker, a range, and the `- **Label** - explanation` bullet separator are unaffected. diff --git a/.claude-plugin/fleet-skills/.source-digests/comment-and-doc-style b/.claude-plugin/fleet-skills/.source-digests/comment-and-doc-style index 2e1a721d3..ccc46430c 100644 --- a/.claude-plugin/fleet-skills/.source-digests/comment-and-doc-style +++ b/.claude-plugin/fleet-skills/.source-digests/comment-and-doc-style @@ -1 +1 @@ -53af967c53a13c26 +b3e100a2d4962906 diff --git a/.claude-plugin/fleet-skills/skills/comment-and-doc-style/SKILL.md b/.claude-plugin/fleet-skills/skills/comment-and-doc-style/SKILL.md index 5650699fa..32a75bb06 100644 --- a/.claude-plugin/fleet-skills/skills/comment-and-doc-style/SKILL.md +++ b/.claude-plugin/fleet-skills/skills/comment-and-doc-style/SKILL.md @@ -291,7 +291,7 @@ It is also because reading those would report a fixture rather than a claim abou Agent-authored text is ASCII by default: documentation, code, comments, commit messages, and PR descriptions. A non-ASCII character is read against the tiers below, because whether one is typography or meaning depends on where it sits. A character in no tier is a finding rather than a -silent pass, a letter of a recorded name excepted per the bullet below. +silent pass. A letter of a recorded name and quoted data are excepted, per the bullets below. - **Tier 1, never legitimate.** Typography carrying no meaning its ASCII form loses. Remove on sight: @@ -324,12 +324,17 @@ silent pass, a letter of a recorded name excepted per the bullet below. document records as data is written with its own letters and the marks they carry. The reason is that folding such a name to ASCII records a different name. Anywhere else a letter the agent writes that no tier covers takes its ASCII form. +- **A Markdown code span is quoted data, as a fenced block is.** A string quoted verbatim from + another source, such as a third party's output, keeps its bytes inside an inline code span. No + tier judges it there. Outside Markdown a backtick is structural, so a code line is read whole. - **An unrecognized non-ASCII character is reported, not allowed.** Classify it into a tier above - before using it. A letter of a recorded name is the one exception, per the bullet above. + before using it. A letter of a recorded name and quoted data are the exceptions, per the bullets + above. - **No semicolon in agent-authored prose.** Recast a mid-sentence semicolon as a comma or as two sentences. A semicolon separating items in a list that already contains commas, or a statement terminator in code, is unaffected. A single semicolon separates such a list only between two labeled items, as in `Inputs: a, b; outputs: c`, and a list item's bold opening label is not one. + A semicolon inside one token, such as `TL;DR`, joins no clause and is unaffected too. - **No spaced hyphen joining or interrupting a sentence** (` - `, or the paired aside ` - x - `). Recast as a comma, two sentences, or parentheses. A hyphen inside a compound word, a leading list marker, a range, and the `- **Label** - explanation` bullet separator are unaffected. diff --git a/.github/actions/prose-gate/prose-gate.json b/.github/actions/prose-gate/prose-gate.json index 7efd39230..d7f56e1a5 100644 --- a/.github/actions/prose-gate/prose-gate.json +++ b/.github/actions/prose-gate/prose-gate.json @@ -3,7 +3,7 @@ "rules": { "charset": { "default": true, "summary": "a non-ASCII character its tier does not permit here" }, "charset-unknown": { "default": true, "summary": "non-ASCII in no tier, bar a Latin letter and its U+0300-U+036F diacritics" }, - "semicolon": { "default": true, "summary": "a semicolon in prose, outside a series or labeled pair carrying a comma" }, + "semicolon": { "default": true, "summary": "a semicolon in prose, outside a series or labeled pair carrying a comma and outside one token" }, "dash": { "default": true, "summary": "a spaced hyphen joining or interrupting a sentence" }, "comment-wrap": { "default": true, "summary": "a comment sentence wrapped across lines, or two on one line" }, "comment-case": { "default": true, "summary": "a comment sentence opening in lowercase" }, diff --git a/.github/actions/prose-gate/prose_lint.py b/.github/actions/prose-gate/prose_lint.py index e4dcd37b9..8302a0498 100755 --- a/.github/actions/prose-gate/prose_lint.py +++ b/.github/actions/prose-gate/prose_lint.py @@ -617,9 +617,12 @@ class Line(NamedTuple): class Unit(NamedTuple): """A run of text one kind of rule reads. - `source` is every line, and `prose` and `code` the unfenced ones. `paragraph` is a Markdown - sentence block. `comment`, `doc`, and `markup` are runs of adjacent comment lines, `doc` a - documentation comment and `markup` a Markdown HTML one. `docstring` opens at `column`. + `source` is every line, and `prose` and `code` the unfenced ones. `spanless` is the unfenced + Markdown lines with each code span's content blanked, front matter and an HTML block read + whole. `codeless` blanks a span there too, paired one line at a time since no inline token + holds those lines. `paragraph` is a Markdown sentence block. `comment`, `doc`, and `markup` + are runs of adjacent comment lines, `doc` a documentation comment and `markup` a Markdown + HTML one. `docstring` opens at `column`. """ kind: str @@ -1001,7 +1004,12 @@ def front_matter_end(lines: list[str]) -> int: def extract_markdown(lines: list[str]) -> Extracted: - """Markdown units from markdown-it-py's block line maps, front matter lines read alone.""" + """Markdown units from markdown-it-py's block line maps, front matter lines read alone. + + Each table cell's inline token maps its whole row. Emptying a span twice is not idempotent, so + a row has its code spans emptied once, a cell at a time. + A blockquote's markers are kept out of a span wrapped across its lines. + """ matter = front_matter_end(lines) code: set[int] = set() paragraphs = [ @@ -1010,6 +1018,7 @@ def extract_markdown(lines: list[str]) -> Extracted: if line.strip() and not line.strip().startswith("#") ] markup: list[Line] = [] + spanless: dict[int, str] = {} parents: list[str] = [] for tok in MARKDOWN.parse("\n".join([""] * matter + lines[matter:])): if tok.nesting: @@ -1029,6 +1038,16 @@ def extract_markdown(lines: list[str]) -> Extracted: paragraphs.append(Unit("paragraph", (Line(n, span),))) elif tok.type == "inline": markup += inline_comments(tok, lines) + if first not in spanless: + numbers = range(first, last + 1) + texts = [lines[n - 1] for n in numbers] + if parents[-1:] in (["th_open"], ["td_open"]): + texts = [by_cell(text, strip_inline_code) for text in texts] + else: + heads = [m.group() if (m := QUOTE_PREFIX.match(t)) else "" for t in texts] + body = "\n".join(t[len(h) :] for t, h in zip(texts, heads, strict=True)) + texts = [h + t for h, t in zip(heads, strip_inline_code(body).split("\n"))] + spanless.update(zip(numbers, texts, strict=True)) if parents[-1:] in BLOCK_PARENTS and "blockquote_open" not in parents: spans = enumerate(tok.content.split("\n")) paragraphs.append( @@ -1038,6 +1057,12 @@ def extract_markdown(lines: list[str]) -> Extracted: units = [ Unit("source", tuple(Line(n, t) for n, t in enumerate(lines, 1))), *line_units("prose", lines, skip), + *line_units("spanless", [spanless.get(n, t) for n, t in enumerate(lines, 1)], skip), + *line_units( + "codeless", + [spanless.get(n, by_cell(t, strip_inline_code)) for n, t in enumerate(lines, 1)], + skip, + ), *paragraphs, *blocks("markup", sorted(markup, key=lambda m: m.number)), ] @@ -1050,8 +1075,7 @@ def inline_comments(tok: Token, lines: list[str]) -> list[Line]: first, last = (tok.map or [0, 1])[0], (tok.map or [0, 1])[1] number, col = first + 1, 0 # A code span can hold a comment's text, so it is blanked, lengths kept, before the search. - blank = lambda m: re.sub(r"[^\n]", " ", m.group()) if m[1] else m.group() - seen = re.sub(MARKDOWN_SPAN, blank, "\n".join(lines[first:last])).split("\n") + seen = blank_code_spans("\n".join(lines[first:last])).split("\n") for child in tok.children or (): if child.type == "html_inline" and child.content.startswith("