Repository navigation
Stop linting fenced code blocks on Vale 3.20+ - #162
Conversation
Vale 3.20.0 masks inline elements listed in SkippedScopes instead of dropping them. With code in that list, fenced code blocks reach the rules, so JSON samples raise QuotesPunctuation, Semicolons, and other warnings in docs PRs. - Remove code from SkippedScopes. IgnoredScopes still masks inline code. - Match applies_to option lines with unquoted keys in BlockIgnores. - Add a code-blocks fixture and regression assertions. - Run the rule tests on Vale 3.23.0, the version docs CI installs. Fixes #161 Co-authored-by: Cursor <[email protected]>
|
Thanks! Checking and merging in a bit |
The `\s*\[anchor\]` entry also matched the newline after a fence line. When a fenced block starts with a bracket token such as `[Service]` or `[DEBUG]`, that broke the fence: Vale linted the block's content and treated the prose after it as code until the next fence. The same match merged a paragraph that opens with a link into the heading before it, which raised EndPunctuation on normal paragraphs. Match only the bracket token. Heading anchors are still masked. Extend the code-blocks fixture with a bracket-leading fence and prose after it, and assert that the prose is linted and the block is not. On a 592-file sample of the docs corpus with Vale 3.23.0 this removes 14 alerts, all false positives, and adds none. The rule tests pass on Vale 3.17.1, 3.19.0, 3.22.0, and 3.23.0. Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
I reviewed this PR and tested it on Vale 3.17.1, 3.19.0, 3.22.0, and 3.23.0. The fix works on all four versions. I also confirmed the fix through the package path that docs CI uses. Thanks for the clear write-up. I pushed one commit to this branch: d4d82c9. It applies the first item from your follow-up list. The The The commit also extends I opened the upstream bug report: vale-cli/vale#1198. The cause is in Two small notes on the description:
After this PR merges, we need a vale-rules release. Docs CI downloads the latest release package. |
…8628) ## Summary Fixes style issues on lines that Vale stops checking after [elastic/vale-rules#162](elastic/vale-rules#162). That PR stops Vale from linting fenced code blocks. Vale can't tell fenced blocks apart from text it reads as indented code, so it also stops checking some prose: definition-list bodies, some indented paragraphs in lists, and comments in code samples. This PR fixes the real issues on those lines now, so they don't stay hidden. The fixes come from a Vale run on `main` with the current and the proposed config. Each lost alert was reviewed by hand in context. Only alerts that match an Elastic style guide rule in that context are fixed: - "may" where it means possibility, changed to "might". "May" for permission is unchanged. - Directional language ("the example above", "described below"). - Latin abbreviations ("e.g.", "etc."), "and/or", "just", "simply", "easily", and "execute". - "or higher", "or newer", and "older version" for versions. - Filler phrases ("in order to", "whether or not", "all of the", "prior to", "utilize", "has the ability to"). - A doubled word ("an an") in a comment on two ECK pages. - British spelling ("acknowledgement"), a comma outside a closing quote, an exclamation point, and two semicolons that introduce a fragment. On the remote cluster pages for Elastic Cloud and ECE, the note now links to the **Using the API** dropdown instead of saying "described below". The dropdowns get a `:name:` anchor, and the link opens them. The Vale check on this PR then flagged a few more issues on the changed lines. These are fixed too: "http" in the SAML troubleshooting page, "not possible" in the ECE architecture page, eight semicolons that now split into two sentences, and two uses of "disabled" that now read "off" and "turned off". The alerts left unchanged fall into two groups. False positives: - Code, placeholders such as `# ...`, and command output. - `applies_to` lines, URLs, and image paths. - "May" the month. - "disable" for turning a setting off. The style guide only restricts it for something broken. - "unable" used correctly. - Product and setting names, such as SASL and `reindex.remote.whitelist`. - The italic setting descriptions on the Elastic Defend advanced settings page. They are verbatim UI text from Kibana's `advanced_policy_schema.ts`. Judgment calls: - Semicolons that join two related clauses correctly, on lines this PR doesn't otherwise change. - "In addition", "inform", "drag and drop", and "as a result of". - "simple" where it means not complex. - "terminate" for processes. - Quoted status values such as "down". Vale with the current config reports 128 fewer alerts on the changed files, and no new ones. The proposed config reports no new alerts either. The PR changes 58 files. The remaining Vale alerts on the changed lines are false positives: "chcon" (a command name) and "blocklisting" (an Elastic Defend term). ## Generative AI disclosure 1. Did you use a generative AI (GenAI) tool to assist in creating this contribution? - [x] Yes - [ ] No Tool(s) and model(s) used: Cursor, Claude Opus 5.5. The list of alerts comes from Vale. Each fix was checked against the style guide and the page context, and the diff was proofread. --------- Co-authored-by: Cursor <[email protected]>
Fixes #161
Summary
Docs CI installs the latest Vale release (3.22.0 or later). Starting with Vale 3.20.0, an inline element listed in
SkippedScopesis masked instead of dropped (33f473d1). Our config listscodethere, so fenced code blocks now reach the rules. JSON samples raiseQuotesPunctuationon every"value",line, and shell and config samples raiseSemicolons,Ellipses, and others.codefromSkippedScopes.prestill skips code blocks, andIgnoredScopesstill masks inline code.applies_toentry inBlockIgnoresso it also matches option lines with unquoted keys, such as:applies_to: { stack: "ga 9.5+, preview =9.4", serverless: ga }. Without this, the scope change exposes those lines toQuotesPunctuation.code-blocks.mdfixture and regression assertions.Impact on docs-content
Linted all 3,001 Markdown files in
docs-content:Compared with the 3.19.0 baseline, this PR removes about 470 alerts. Most are
Repetitionfalse positives that appeared because dropping inline code joined words, for example "Set to0to skip" read as "to to". About 40 areapplies_tooption lines. It adds 9 alerts, all on prose lines (Wordiness,Clone,PluralAbbreviations, and frontmatter).Trade-offs
Vale lints the HTML it builds from the Markdown, and it skips text by element. Fenced blocks, and any text that Vale's parser reads as an indented code block, become
<pre><code>. The config can't skip fenced blocks without also skipping that text.Since Vale 3.20, CI has linted all of it. This PR goes back to skipping it, so these alerts stop:
Options are kprobe, ebpf, quark or auto.(OxfordComma) ondefend-advanced-settings.md.**patterns inTokenIgnoresbreak the list, so an indented paragraph in it reads as code. Example:migrate the example above(DirectionalLanguage) onchange-hardware.md.# chcon is only required when running an an SELinux-enabled/OpenShift environment.(Repetition) on two ECK pages.description:on bothautomatic-import.mdpages.Outside fenced blocks, about 360 alerts stop. Most are real issues, but about 45 are false positives on
applies_tooption lines. CI on Vale 3.19 missed about 320 of the 360 as well.Possible follow-ups:
**patterns inTokenIgnores.IgnoredScopesalready masksstrong.\s*from the[anchor]pattern inTokenIgnores. It matches the newline after a fence line, which breaks the fence when the block starts with[word].Test plan
python3 rule-tests/run_rule_tests.pypasses on Vale 3.17.1, 3.19.0, 3.20.0, and 3.23.0.mainversion of.vale.ini, the new assertion fails on Vale 3.23.0.docs/reference/connectors-kibana/slack-v2-action-type.mdfrom [One workflow] Add Slack v2 inbound events kibana#293749 no longer raisesQuotesPunctuationinside its JSON sample.After merge
Docs CI downloads the latest release package, so this fix reaches PRs only after a new release.