Skip to content

fix: let a hard line break keep a nested list separate - #1226

Open
any-victor wants to merge 1 commit into
vale-cli:v3from
any-victor:fix/void-tag-promotion
Open

any-victor wants to merge 1 commit into
vale-cli:v3from
any-victor:fix/void-tag-promotion

Conversation

@any-victor

Copy link
Copy Markdown

Closes #1225.

Motivation

A hard line-break renders as <br>, which has no end tag. While Vale walks the HTML, it keeps a history of open tags, and nothing removed <br> from it. Vale then read the list item as still inside an inline element:

  • A nested list after the break joined the item above, so a list rule saw one long item.
  • Inside emphasis, the stale <br> also blocked </em>, which removes its tag only when that tag is last in the history.

Change

A void tag now leaves the history as soon as it is added, in internal/lint/ast.go.

Verification

  • The new scopes case, list-item-with-hard-break, checks a plain hard break and one inside *…*. Each item is counted on its own: 4, 7, 7 and 7 words. For the plain case, this matches 3.24.0, positions included.
  • With the fix reverted, each file reports one item of 25 words.
  • go test ./... passes on Linux with the grammars built.
  • golangci-lint v2.15 reports no issues.
  • The commit message passes the commit-msg hook.

Assisted-by: Claude Code

A hard line break renders as <br>, which has no end tag. Nothing
removed it from the tag history, so Vale read it as an open inline
element. A nested list after it joined the list item above, and an
enclosing </em> could not pop its own tag. A void tag now leaves the
history as soon as it enters.

Closes vale-cli#1225.

Assisted-by: Claude Code
@github-actions

github-actions Bot commented Nov 9, 2026

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 Nov 9, 2026 •

Copy link
Copy Markdown

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

@any-victor

Copy link
Copy Markdown
Author

I have read the CLA and I agree to it

This branch has not been deployed

No deployments
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.

A hard line break in a list item joins the item with its nested list (since 3.25.0)

1 participant