Skip to content

Commit 582134c

Browse files
committed
Move custom rules to markdownlint-rules and ascii-only: ignore code blocks
- Rename .markdownlint-rules to markdownlint-rules; update paths in configs, workflows, Makefile, README, CONTRIBUTING, eslint, package.json, .gitignore. - ascii-only: skip content inside fenced code blocks by default; add allowUnicodeInCodeBlocks and disallowUnicodeInCodeBlockTypes options. - Update fixtures and expected_errors for ascii-only; adjust rule unit tests and Python verifier for new paths.
1 parent 71d2684 commit 582134c

32 files changed

Lines changed: 1313 additions & 407 deletions

‎.github/workflows/js-lint.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ name: JS Lint
88
on:
99
push:
1010
paths:
11-
- '.markdownlint-rules/**/*.js'
11+
- 'markdownlint-rules/**/*.js'
1212
- 'eslint.config.cjs'
1313
- 'package.json'
1414
- 'package-lock.json'

‎.github/workflows/lint-readmes.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ on:
1111
- '**/README.md'
1212
- '.markdownlint-cli2.jsonc'
1313
- '.markdownlint.yml'
14-
- '.markdownlint-rules/**'
14+
- 'markdownlint-rules/**'
1515
- 'Makefile'
1616
pull_request:
1717
paths:
1818
- '**/README.md'
1919
- '.markdownlint-cli2.jsonc'
2020
- '.markdownlint.yml'
21-
- '.markdownlint-rules/**'
21+
- 'markdownlint-rules/**'
2222
- 'Makefile'
2323

2424
jobs:

‎.github/workflows/markdownlint-tests.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ on:
88
paths:
99
- '.markdownlint-cli2.jsonc'
1010
- '.markdownlint.yml'
11-
- '.markdownlint-rules/**'
11+
- 'markdownlint-rules/**'
1212
- 'md_test_files/**'
1313
pull_request:
1414
paths:
1515
- '.markdownlint-cli2.jsonc'
1616
- '.markdownlint.yml'
17-
- '.markdownlint-rules/**'
17+
- 'markdownlint-rules/**'
1818
- 'md_test_files/**'
1919

2020
jobs:

‎.github/workflows/rule-unit-tests.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
name: Rule unit tests
22

3-
# Unit tests for .markdownlint-rules/*.js (Node test runner) with coverage (fails if any file < 90%).
3+
# Unit tests for markdownlint-rules/*.js (Node test runner) with coverage (fails if any file < 90%).
44
# NOTE: Keep in sync with the 'test-rules' and 'test-rules-coverage' targets in the root Makefile.
55

66
on:
77
push:
88
paths:
9-
- '.markdownlint-rules/**/*.js'
9+
- 'markdownlint-rules/**/*.js'
1010
- 'test/markdownlint-rules/**'
1111
- 'package.json'
1212
- 'package-lock.json'

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,6 @@ coverage.*
4343
# Ignore Python cache files
4444
**/__pycache__/
4545
.pytest_cache/
46+
47+
# Ignore test files
48+
md_test_files/negative_document_length.md

‎.markdownlint-cli2.jsonc‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010
"**/*.plan.md"
1111
],
1212
"customRules": [
13-
".markdownlint-rules/no-heading-like-lines.js",
14-
".markdownlint-rules/allow-custom-anchors.js",
15-
".markdownlint-rules/no-duplicate-headings-normalized.js",
16-
".markdownlint-rules/heading-numbering.js",
17-
".markdownlint-rules/heading-title-case.js",
18-
".markdownlint-rules/ascii-only.js"
13+
"markdownlint-rules/no-heading-like-lines.js",
14+
"markdownlint-rules/allow-custom-anchors.js",
15+
"markdownlint-rules/no-duplicate-headings-normalized.js",
16+
"markdownlint-rules/heading-numbering.js",
17+
"markdownlint-rules/heading-title-case.js",
18+
"markdownlint-rules/ascii-only.js",
19+
"markdownlint-rules/document-length.js"
1920
]
2021
}

‎.markdownlint.yml‎

Lines changed: 24 additions & 222 deletions
Original file line numberDiff line numberDiff line change
@@ -1,254 +1,56 @@
11
---
2-
# Example markdownlint YAML configuration with all properties set to their default value
2+
# markdownlint configuration: default built-in rules plus custom rule overrides
33

4-
# Default state for all rules
54
default: true
65

7-
# Path to configuration file to extend
8-
# extends: null
9-
10-
# MD001/heading-increment/header-increment - Heading levels should only increment by one level at a time
11-
MD001: true
12-
13-
# MD002/first-heading-h1/first-header-h1 - First heading should be a top-level heading
14-
MD002:
15-
# Heading level
16-
level: 1
17-
18-
# MD003/heading-style/header-style - Heading style
19-
MD003:
20-
# Heading style
21-
style: "consistent"
22-
23-
# MD004/ul-style - Unordered list style
24-
MD004:
25-
# List style
26-
style: "consistent"
27-
28-
# MD005/list-indent - Inconsistent indentation for list items at the same level
29-
MD005: true
30-
31-
# MD006/ul-start-left - Consider starting bulleted lists at the beginning of the line
32-
MD006: true
33-
34-
# MD007/ul-indent - Unordered list indentation
35-
MD007:
36-
# Spaces for indent
37-
indent: 2
38-
# Whether to indent the first level of the list
39-
start_indented: false
40-
41-
# MD009/no-trailing-spaces - Trailing spaces
42-
MD009:
43-
# Spaces for line break
44-
br_spaces: 2
45-
# Allow spaces for empty lines in list items
46-
list_item_empty_lines: false
47-
# Include unnecessary breaks
48-
strict: false
49-
50-
# MD010/no-hard-tabs - Hard tabs
51-
MD010:
52-
# Include code blocks
53-
code_blocks: true
54-
# Number of spaces for each hard tab
55-
# spaces_per_tab: 1
56-
57-
# MD011/no-reversed-links - Reversed link syntax
58-
MD011: true
59-
60-
# MD012/no-multiple-blanks - Multiple consecutive blank lines
61-
MD012:
62-
# Consecutive blank lines
63-
maximum: 1
64-
65-
# MD013/line-length - Line length
6+
# MD013/line-length - line length limits (non-default)
667
MD013:
67-
# Number of characters
688
line_length: 500
69-
# Number of characters for headings
709
heading_line_length: 500
71-
# Number of characters for code blocks
7210
code_block_line_length: 500
73-
# Include code blocks
7411
code_blocks: true
75-
# Include tables
7612
tables: true
77-
# Include headings
7813
headings: true
79-
# Strict length checking
8014
strict: false
81-
# Stern length checking
8215
stern: false
8316

84-
# MD014/commands-show-output - Dollar signs used before commands without showing output
85-
MD014: true
86-
87-
# MD018/no-missing-space-atx - No space after hash on atx style heading
88-
MD018: true
89-
90-
# MD019/no-multiple-space-atx - Multiple spaces after hash on atx style heading
91-
MD019: true
92-
93-
# MD020/no-missing-space-closed-atx - No space inside hashes on closed atx style heading
94-
MD020: true
95-
96-
# MD021/no-multiple-space-closed-atx - Multiple spaces inside hashes on closed atx style heading
97-
MD021: true
98-
99-
# MD022/blanks-around-headings/blanks-around-headers - Headings should be surrounded by blank lines
100-
MD022:
101-
# Blank lines above heading
102-
lines_above: 1
103-
# Blank lines below heading
104-
lines_below: 1
105-
106-
# MD023/heading-start-left/header-start-left - Headings must start at the beginning of the line
107-
MD023: true
108-
109-
# MD024/no-duplicate-heading/no-duplicate-header - Multiple headings with the same content
110-
MD024:
111-
# Only check sibling headings
112-
siblings_only: false
113-
114-
# MD025/single-title/single-h1 - Multiple top-level headings in the same document
115-
MD025:
116-
# Heading level
117-
level: 1
118-
# RegExp for matching title in front matter
119-
front_matter_title: "^\\s*title\\s*[:=]"
120-
121-
# MD026/no-trailing-punctuation - Trailing punctuation in heading
122-
MD026:
123-
# Punctuation characters
124-
punctuation: ".,;:!。,;:!"
125-
126-
# MD027/no-multiple-space-blockquote - Multiple spaces after blockquote symbol
127-
MD027: true
128-
129-
# MD028/no-blanks-blockquote - Blank line inside blockquote
130-
MD028: true
131-
132-
# MD029/ol-prefix - Ordered list item prefix
133-
MD029:
134-
# List style
135-
style: "one_or_ordered"
136-
137-
# MD030/list-marker-space - Spaces after list markers
138-
MD030:
139-
# Spaces for single-line unordered list items
140-
ul_single: 1
141-
# Spaces for single-line ordered list items
142-
ol_single: 1
143-
# Spaces for multi-line unordered list items
144-
ul_multi: 1
145-
# Spaces for multi-line ordered list items
146-
ol_multi: 1
147-
148-
# MD031/blanks-around-fences - Fenced code blocks should be surrounded by blank lines
149-
MD031:
150-
# Include list items
151-
list_items: true
152-
153-
# MD032/blanks-around-lists - Lists should be surrounded by blank lines
154-
MD032: true
155-
156-
# MD033/no-inline-html - Inline HTML
17+
# MD033/no-inline-html - allow anchor elements for custom anchors
15718
MD033:
158-
# Allowed elements
15919
allowed_elements: ["a"]
16020

161-
# MD034/no-bare-urls - Bare URL used
162-
MD034: true
163-
164-
# MD035/hr-style - Horizontal rule style
165-
MD035:
166-
# Horizontal rule style
167-
style: "consistent"
168-
169-
# MD036/no-emphasis-as-heading/no-emphasis-as-header - Emphasis used instead of a heading
170-
MD036:
171-
# Punctuation characters
172-
punctuation: ".,;:!?。,;:!?"
173-
174-
# MD037/no-space-in-emphasis - Spaces inside emphasis markers
175-
MD037: true
176-
177-
# MD038/no-space-in-code - Spaces inside code span elements
178-
MD038: true
179-
180-
# MD039/no-space-in-links - Spaces inside link text
181-
MD039: true
182-
183-
# MD040/fenced-code-language - Fenced code blocks should have a language specified
184-
MD040: true
185-
186-
# MD041/first-line-heading/first-line-h1 - First line in a file should be a top-level heading
187-
MD041:
188-
# Heading level
189-
level: 1
190-
# RegExp for matching title in front matter
191-
front_matter_title: "^\\s*title\\s*[:=]"
192-
193-
# MD042/no-empty-links - No empty links
194-
MD042: true
195-
196-
# MD043/required-headings/required-headers - Required heading structure
197-
# MD043:
198-
# List of headings
199-
# headings: ["*"]
200-
# List of headings
201-
# headers: []
202-
203-
# MD044/proper-names - Proper names should have the correct capitalization
204-
MD044:
205-
# List of proper names
206-
names: []
207-
# Include code blocks
208-
code_blocks: true
209-
210-
# MD045/no-alt-text - Images should have alternate text (alt text)
211-
MD045: true
212-
213-
# MD046/code-block-style - Code block style
214-
MD046:
215-
# Block style
216-
style: "consistent"
217-
218-
# MD047/single-trailing-newline - Files should end with a single newline character
219-
MD047: true
220-
221-
# MD048/code-fence-style - Code fence style
222-
MD048:
223-
# Code fence style
224-
style: "consistent"
225-
226-
# MD060/table-column-style - Table column style
227-
MD060:
228-
# Table column style
229-
style: "aligned"
230-
231-
# ascii-only: no built-in path/emoji defaults; set paths and emoji in config
232-
# - allowedUnicode: optional; single chars allowed in all files (no default)
233-
# - unicodeReplacements: optional; if omitted, rule uses built-in defaults (arrows, quotes, <=>=*)
21+
# ascii-only: disallow non-ASCII except in configured paths; inline code (backticks) always stripped
22+
# No built-in path/emoji defaults. Options:
23+
# - allowedPathPatternsUnicode: glob list; files where any non-ASCII is allowed
24+
# - allowedPathPatternsEmoji: glob list; files where only allowedEmoji chars are allowed
25+
# - allowedEmoji: emoji/chars allowed in paths matching allowedPathPatternsEmoji (multi-codepoint OK)
26+
# - allowedUnicode: chars allowed in all files; extends default set (é, ï, ñ, ç, etc.) unless replace below
27+
# - allowedUnicodeReplaceDefault: true = use only allowedUnicode list (no default set)
28+
# - allowUnicodeInCodeBlocks: true (default) = skip fenced blocks; false = check them for unicode
29+
# - disallowUnicodeInCodeBlockTypes: when allowUnicodeInCodeBlocks false, only these block types checked
30+
# (block type = first word after opening fence, e.g. "text" from ```text); empty = check all blocks
31+
# - unicodeReplacements: object or [char, replacement] array; built-in defaults (arrows, quotes, <=>=*) if omitted
23432
ascii-only:
23533
allowedPathPatternsUnicode:
23634
# - "**/README.md"
23735
allowedPathPatternsEmoji:
238-
- ".markdownlint-rules/README.md"
36+
- "markdownlint-rules/README.md"
37+
# allowedUnicode:
38+
# - "ń" # additions on top of default (fixtures e.g. positive.md)
39+
# allowedUnicodeReplaceDefault: false # true = use only allowedUnicode list, no default set
23940
allowedEmoji:
24041
- "✅"
24142
- "❌"
24243
- "📊"
24344
- "⚠️"
24445

245-
# heading-title-case: enforce title case for headings; words in backticks ignored; configurable lowercase words
46+
# heading-title-case: AP-style headline capitalization; words in backticks ignored
24647
# heading-title-case:
247-
# lowercaseWords: ["a", "an", "the", "vs", ...] # optional override; default list used if omitted
48+
# lowercaseWords: ["through", ...] # optional; extends default list (add words)
49+
# lowercaseWordsReplaceDefault: true # optional; true = use only lowercaseWords list, no default set
24850

249-
# allow-custom-anchors: anchor id patterns and optional placement per pattern
250-
# - allowedIdPatterns: array of regex strings or { pattern, placement? }; placement is per anchor regex
251-
# - strictPlacement: if true (default), enforce placement when placement is set for that pattern
51+
# allow-custom-anchors: require anchor ids to match patterns; optional placement (line/heading) per pattern
52+
# - allowedIdPatterns: list of regex strings or { pattern, placement? }; placement applies per pattern
53+
# - strictPlacement: true (default) = enforce placement when a pattern has placement set
25254
allow-custom-anchors:
25355
allowedIdPatterns:
25456
- pattern: "^spec-[a-z0-9-]+$"

‎.vscode/settings.json‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
{
22
"markdownlint.customRules": [
3-
"./.markdownlint-rules/allow-custom-anchors.js",
4-
"./.markdownlint-rules/ascii-only.js",
5-
"./.markdownlint-rules/heading-numbering.js",
6-
"./.markdownlint-rules/heading-title-case.js",
7-
"./.markdownlint-rules/no-duplicate-headings-normalized.js",
8-
"./.markdownlint-rules/no-heading-like-lines.js"
3+
"./markdownlint-rules/allow-custom-anchors.js",
4+
"./markdownlint-rules/ascii-only.js",
5+
"./markdownlint-rules/heading-numbering.js",
6+
"./markdownlint-rules/heading-title-case.js",
7+
"./markdownlint-rules/no-duplicate-headings-normalized.js",
8+
"./markdownlint-rules/no-heading-like-lines.js",
9+
"./markdownlint-rules/document-length.js"
910
]
1011
}

0 commit comments

Comments
 (0)