Skip to content

Pair Code Spans as Markdown Does in sentence-length and dead-path #4135

Closed

Description

@ptr727

Observed

prose_lint.py's sentence-length rule misses an over-cap sentence that follows an escaped backtick. mask_code_and_quotes blanks code spans with the bare CODE_SPAN pattern, which does not skip an escape. So it pairs the escaped backtick with the next real span's opener, and blanks every word between them.

Constructed reproduction, where W is 30 copies of the word word:

$ printf 'Use \\` here. %s. End `x` now.\n\nUse a tick here. %s. End `x` now.\n' "$W" "$W" > a.md
$ python3 scripts/prose_lint.py a.md --check sentence-length
1 violation(s) across 1 file(s)
  sentence-length  1
a.md:3: sentence-length: 30 words in one sentence -> sentences of 25 words or fewer

Line 1 carries the same 30-word sentence as line 3 and is not reported.

The class

Both sites pair code spans without the span-aware MARKDOWN_SPAN pattern that blank_code_spans uses:

  • mask_code_and_quotes, which sentence-length reads, uses bare CODE_SPAN, so an escaped backtick opens a span.
  • rule_dead_path scans LINK_TARGET over strip_inline_code, and INLINE_SPAN pairs backticks one line at a time too. A code span wrapped across a line break leaves its closer to pair with the next span's opener, so a link between them is hidden from the scan.

Expected

Each site pairs a code span as Markdown does, escapes and wrapped spans included, through the one primitive the charset and other prose rules already read.

Raised by a local review pass on the branch that moved the charset, semicolon, dash, dupword, spelling, and sentence-split rules onto that primitive.

Activity

  1. added
    pre-existing
    on Nov 13, 2026
  2. ptr727 commented on Nov 13, 2026

    @ptr727
    OwnerAuthor

    Backlog burndown claim, round 2 (2026-11-13), away run, scope develop. Branch burndown/hook-chain-gate, group: #4131, #4135, #4123, #4108. Tier: frontier (carried hook snippets and helper, the prose gate, entangled across one hook chain).

    Predicted files:

    • .github/actions/prose-gate/prose_lint.py
    • .github/actions/prose-gate/prose-gate.json
    • scripts/prose_lint.py
    • tests/test_prose_lint.py
    • catalog/snippets/pre-commit/.pre-commit-config.yaml
    • catalog/snippets/pre-commit/README.md
    • catalog/snippets/husky/pre-commit
    • catalog/snippets/husky/README.md
    • .husky/pre-commit
    • .husky/pre-push
    • catalog/snippets/hub_fetch_run.py
    • tests/test_hub_fetch_run.py
    • tests/test_pre_commit_hook.py
    • scripts/README.md
    • GOVERNANCE.md ("Running the Linters Locally (Known-Working Invocations)", the hook's diff-base sentence)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    pre-existing

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions