Skip to content

SkippedScopes with both pre and code lints fenced code blocks since 3.20.0 #1198

Closed
theletterf/docs-actions
#1

Description

@theletterf

Check for existing issues

  • Completed

Environment

  • macOS 15 (arm64)
  • Direct download from GitHub releases
  • Vale 3.23.0. Also reproduced on 3.22.0. Not reproducible on 3.19.0.

Describe the bug / provide steps to reproduce it

Since 3.20.0, a config that lists both pre and code in SkippedScopes lints the content of fenced code blocks. The same config skipped them on 3.19.0 and earlier. I hit this through Elastic's shared style config (elastic/vale-rules#162), where code has been in SkippedScopes since 2025. After our docs CI moved to 3.22.0, every JSON sample in the docs started raising punctuation alerts.

Minimal reproduction:

.vale.ini

StylesPath = styles
MinAlertLevel = suggestion
SkippedScopes = script, style, pre, code

[*.md]
BasedOnStyles = Test

styles/Test/Semicolon.yml

extends: existence
message: "Semicolon found."
level: warning
nonword: true
tokens:
  - ';'

test.md

# Title

Prose with `inline; code` and a fenced block:

```json
{ "a": 1; "b": 2 }
```

Prose after the block; with a semicolon.

Expected, and what 3.19.0 reports: only line 9.

test.md:9:22:Test.Semicolon:Semicolon found.

Actual on 3.22.0 and 3.23.0: line 6, inside the fence, is linted too.

test.md:6:9:Test.Semicolon:Semicolon found.
test.md:9:22:Test.Semicolon:Semicolon found.

Removing code from SkippedScopes and keeping pre restores the expected output on all three versions. The inline span on line 3 is handled correctly either way: dropped on 3.19.0, masked on 3.20+.

What I think is happening: 33f473d ("mask an inline element in SkippedScopes instead of dropping it") made the block-skip branch in lintHTMLTokens ignore inline tags. A fenced block renders as <pre><code>. The <pre> start tag still sets inBlock = true, but the <code> start tag that follows no longer matches that first branch, so it falls through to

} else if inBlock && (core.StringInSlice(txt, skipTags) || closed) {
    inBlock = false

which is meant to catch the end of the skipped block. Because code is in skipTags, the <code> start tag ends the <pre> skip, and the block's text is linted. Before that commit the first branch caught <code> and re-entered the skip, which hid the problem. The branch reads the same on main today.

One option might be to only end a skipped block on an end tag, or to leave inline tags out of the skipTags check in that branch, since inline skipped elements are now masked further down. Happy to test a fix against the Elastic config if that helps.

Activity

  1. added a commit that references this issue on Oct 1, 2026
    424f6e6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions