Skip to content

fix: place a summary-scoped alert on the prose it counted - #1192

Merged
jdkato merged 2 commits into
vale-cli:v3from
Eljees:fix/1191-summary-anchor
Sep 24, 2026
Merged

jdkato merged 2 commits into
vale-cli:v3from
Eljees:fix/1191-summary-anchor

Conversation

@Eljees

@Eljees Eljees commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Fixes #1191.

The summary block had no position in the source, so a match found in it was placed by searching the whole file for its text, and the first copy won, even in front matter, a code block or a heading that the summary never held. Each piece of prose written to the summary now records where it sits in the source as runs (the mapping blocks with inline markup already use), and the summary block carries them, so anchor() places the match where it was counted. The summary text itself is unchanged.

On the issue's reproducer, front.md, code.md and heading.md now report 7:10, 7:10 and 3:10; control.md stays at 3:10. The new e2e case checks/occurrence-summary-anchor fails on v3 and passes with the change; the rest of the suite passes locally (the AsciiDoc/RST cases were skipped here, no asciidoctor/rst2html).

Assisted-by: Claude Code

The summary block had no position in the source, so a match found in
it was located by searching the whole file for its text, and the first
copy won -- in front matter, a code block, or a heading, none of which
the summary holds.

Record where each piece of prose written to the summary sits in the
source, as runs, the way a block carrying inline markup already does,
so the match is anchored where it was counted.

Fixes vale-cli#1191

Signed-off-by: Eljees <57435526+Eljees@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown

Before this is reviewed, please read the AI-Assisted Contributions section of the contributing guide and make sure this change meets it: you can explain every line, the description is your own and brief, it fixes a bug you hit or a feature agreed in an issue, it does not touch undocumented options, and any substantial tool use is noted.

@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

The license agreement is signed.
Posted by the CLA Assistant Lite bot.

@Eljees

Eljees commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

I have read the CLA and I agree to it

@jdkato
jdkato merged commit 706f858 into vale-cli:v3 Sep 24, 2026
9 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 24, 2026
@jdkato

jdkato commented Sep 24, 2026

Copy link
Copy Markdown
Member

Merged, thanks. I resolved the conflict with #1186 locally and fixed a letter in the scenario name on the way in. The benchstat toolchain change is welcome too; that job had been red for a while.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

occurrence alert is placed on the first copy of the match anywhere in the file, outside the rule's scope

2 participants