rubocop-prose 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/AGENTS.md +10 -2
- data/CHANGELOG.md +20 -0
- data/CONTRIBUTING.md +17 -7
- data/DESIGN.md +13 -5
- data/README.md +37 -20
- data/RELEASING.md +8 -8
- data/UPGRADING.md +16 -0
- data/assets/README.md +1 -1
- data/config/cops/markdown/code_block_style.yml +1 -1
- data/config/cops/markdown/emphasis_style.yml +4 -0
- data/config/cops/markdown/fence_style.yml +1 -1
- data/config/cops/markdown/first_heading.yml +1 -2
- data/config/cops/markdown/front_matter_keys.yml +5 -0
- data/config/cops/markdown/front_matter_syntax.yml +3 -0
- data/config/cops/markdown/hard_break_style.yml +3 -0
- data/config/cops/markdown/hard_tabs.yml +1 -1
- data/config/cops/markdown/heading_capitalization.yml +31 -0
- data/config/cops/markdown/heading_style.yml +1 -1
- data/config/cops/markdown/{syntax.yml → kramdown_syntax.yml} +1 -1
- data/config/cops/markdown/list_item_capitalization.yml +32 -0
- data/config/cops/markdown/list_item_punctuation.yml +13 -0
- data/config/cops/markdown/list_marker_spacing.yml +6 -5
- data/config/cops/markdown/ordered_list_numbering.yml +1 -1
- data/config/cops/markdown/reference_definitions.yml +2 -3
- data/config/cops/markdown/strong_style.yml +4 -0
- data/config/cops/markdown/structural_line_length.yml +1 -4
- data/config/cops/markdown/table_pipes.yml +6 -0
- data/config/cops/markdown/table_spacing.yml +4 -0
- data/config/cops/markdown/trailing_whitespace.yml +1 -0
- data/config/cops/markdown/unordered_list_marker.yml +1 -1
- data/config/cops/prose/sentence_capitalization.yml +9 -0
- data/config/cops/text/hard_tabs.yml +3 -0
- data/config/cops/text/proper_names.yml +4 -0
- data/config/obsoletion.yml +45 -0
- data/docs/cops/markdown/blockquote_spacing.md +2 -0
- data/docs/cops/markdown/code_block_style.md +11 -2
- data/docs/cops/markdown/duplicate_headings.md +51 -0
- data/docs/cops/markdown/emphasis_style.md +5 -1
- data/docs/cops/markdown/fence_style.md +11 -2
- data/docs/cops/markdown/first_heading.md +29 -3
- data/docs/cops/markdown/front_matter_keys.md +57 -0
- data/docs/cops/markdown/front_matter_syntax.md +32 -0
- data/docs/cops/markdown/hard_break_style.md +10 -5
- data/docs/cops/markdown/hard_tabs.md +3 -3
- data/docs/cops/markdown/heading_capitalization.md +176 -0
- data/docs/cops/markdown/heading_style.md +11 -2
- data/docs/cops/markdown/{syntax.md → kramdown_syntax.md} +6 -2
- data/docs/cops/markdown/list_item_capitalization.md +115 -0
- data/docs/cops/markdown/list_item_punctuation.md +70 -0
- data/docs/cops/markdown/list_marker_spacing.md +57 -7
- data/docs/cops/markdown/ordered_list_numbering.md +10 -1
- data/docs/cops/markdown/proper_names.md +3 -3
- data/docs/cops/markdown/raw_html.md +99 -6
- data/docs/cops/markdown/reference_definitions.md +30 -4
- data/docs/cops/markdown/strong_style.md +5 -1
- data/docs/cops/markdown/structural_line_length.md +31 -7
- data/docs/cops/markdown/table_pipes.md +7 -1
- data/docs/cops/markdown/table_spacing.md +5 -1
- data/docs/cops/markdown/thematic_break_style.md +2 -0
- data/docs/cops/markdown/trailing_whitespace.md +29 -0
- data/docs/cops/markdown/unordered_list_marker.md +11 -2
- data/docs/cops/prose/multiple_blank_lines.md +2 -0
- data/docs/cops/prose/sentence_capitalization.md +46 -0
- data/docs/cops/text/hard_tabs.md +28 -0
- data/docs/cops/text/proper_names.md +36 -0
- data/docs/settings/files.md +1 -1
- data/docs/settings/front_matter.md +2 -2
- data/lib/rubocop/cop/markdown/code_block_style.rb +1 -1
- data/lib/rubocop/cop/markdown/code_span_spacing.rb +2 -2
- data/lib/rubocop/cop/markdown/duplicate_headings.rb +55 -5
- data/lib/rubocop/cop/markdown/emphasis_spacing.rb +1 -1
- data/lib/rubocop/cop/markdown/emphasis_style.rb +7 -0
- data/lib/rubocop/cop/markdown/fence_style.rb +1 -1
- data/lib/rubocop/cop/markdown/first_heading.rb +13 -2
- data/lib/rubocop/cop/markdown/front_matter_keys.rb +70 -0
- data/lib/rubocop/cop/markdown/front_matter_syntax.rb +26 -0
- data/lib/rubocop/cop/markdown/hard_tabs.rb +11 -7
- data/lib/rubocop/cop/markdown/heading_capitalization.rb +43 -0
- data/lib/rubocop/cop/markdown/heading_style.rb +1 -1
- data/lib/rubocop/cop/markdown/{syntax.rb → kramdown_syntax.rb} +1 -1
- data/lib/rubocop/cop/markdown/list_item_capitalization.rb +90 -0
- data/lib/rubocop/cop/markdown/list_item_punctuation.rb +64 -0
- data/lib/rubocop/cop/markdown/list_marker_spacing.rb +13 -4
- data/lib/rubocop/cop/markdown/ordered_list_numbering.rb +1 -1
- data/lib/rubocop/cop/markdown/outside_spacing.rb +6 -6
- data/lib/rubocop/cop/markdown/proper_names.rb +20 -31
- data/lib/rubocop/cop/markdown/raw_html.rb +62 -7
- data/lib/rubocop/cop/markdown/reference_definitions.rb +15 -5
- data/lib/rubocop/cop/markdown/strong_style.rb +7 -0
- data/lib/rubocop/cop/markdown/structural_line_length.rb +7 -6
- data/lib/rubocop/cop/markdown/table_blank_lines.rb +1 -1
- data/lib/rubocop/cop/markdown/table_columns.rb +1 -1
- data/lib/rubocop/cop/markdown/table_pipes.rb +8 -1
- data/lib/rubocop/cop/markdown/table_spacing.rb +8 -1
- data/lib/rubocop/cop/markdown/thematic_break_style.rb +4 -0
- data/lib/rubocop/cop/markdown/trailing_whitespace.rb +6 -0
- data/lib/rubocop/cop/markdown/unordered_list_marker.rb +1 -1
- data/lib/rubocop/cop/prose/sentence_capitalization.rb +100 -0
- data/lib/rubocop/cop/text/hard_tabs.rb +21 -0
- data/lib/rubocop/cop/text/proper_names.rb +20 -0
- data/lib/rubocop/prose/capitalization_rules.rb +189 -0
- data/lib/rubocop/prose/inline_rules.rb +17 -10
- data/lib/rubocop/prose/link_rules.rb +34 -13
- data/lib/rubocop/prose/markdown_document.rb +30 -8
- data/lib/rubocop/prose/proper_name_rules.rb +31 -0
- data/lib/rubocop/prose/structural_blank_lines.rb +1 -1
- data/lib/rubocop/prose/table_rules.rb +1 -1
- data/lib/rubocop/prose/version.rb +1 -1
- data/lib/rubocop-prose.rb +3 -0
- metadata +32 -4
|
@@ -9,7 +9,7 @@ Report-only: changing syntax can alter heading levels or surrounding structure.
|
|
|
9
9
|
```yaml
|
|
10
10
|
Markdown/HeadingStyle:
|
|
11
11
|
Enabled: false
|
|
12
|
-
|
|
12
|
+
Style: consistent # consistent, atx, atx_closed or setext.
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Example
|
|
@@ -19,7 +19,7 @@ For this configuration:
|
|
|
19
19
|
```yaml
|
|
20
20
|
Markdown/HeadingStyle:
|
|
21
21
|
Enabled: true
|
|
22
|
-
|
|
22
|
+
Style: atx
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
### Bad
|
|
@@ -34,3 +34,12 @@ Title
|
|
|
34
34
|
```markdown
|
|
35
35
|
# Title
|
|
36
36
|
```
|
|
37
|
+
|
|
38
|
+
## Migrating From 0.1.0
|
|
39
|
+
|
|
40
|
+
Replace `EnforcedStyle` with `Style`:
|
|
41
|
+
|
|
42
|
+
```yaml
|
|
43
|
+
Markdown/HeadingStyle:
|
|
44
|
+
Style: atx
|
|
45
|
+
```
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Markdown/
|
|
1
|
+
# Markdown/KramdownSyntax
|
|
2
2
|
|
|
3
3
|
Reports Kramdown GFM parsing warnings through RuboCop. Report-only.
|
|
4
4
|
|
|
@@ -7,7 +7,7 @@ Reference warnings are handled by [Markdown/UndefinedReference](undefined_refere
|
|
|
7
7
|
## Configuration
|
|
8
8
|
|
|
9
9
|
```yaml
|
|
10
|
-
Markdown/
|
|
10
|
+
Markdown/KramdownSyntax:
|
|
11
11
|
Enabled: true
|
|
12
12
|
```
|
|
13
13
|
|
|
@@ -26,3 +26,7 @@ Markdown/Syntax:
|
|
|
26
26
|
|
|
27
27
|
[docs]: /guide
|
|
28
28
|
```
|
|
29
|
+
|
|
30
|
+
## Migrating From 0.1.0
|
|
31
|
+
|
|
32
|
+
Rename this plugin's `Markdown/Syntax` configuration to `Markdown/KramdownSyntax`. When using RuboCop-md 3.0.0 or newer, `Markdown/Syntax` configures its separate cop; leave that disabled to avoid duplicate parser warnings.
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Markdown/ListItemCapitalization
|
|
2
|
+
|
|
3
|
+
Checks capitalization in ordered and unordered list items. `Style` supports `consistent` (default), `initial_capital`, and `title_case`. The word settings follow [Markdown/HeadingCapitalization](heading_capitalization.md).
|
|
4
|
+
|
|
5
|
+
In `consistent` mode, the first eligible item establishes uppercase or lowercase initials; nested and separate lists establish their own style. `initial_capital` requires uppercase initials regardless of sibling style. Both inspect only the initial word, including emphasis, link labels, quotes, inline code, and optional task checkboxes. Code and quoted openings are treated as literal text and are never autocorrected. Images, HTML, entities, numbers, punctuation, uncased letters, paths, URLs, and ambiguous identifiers are skipped. The cop does not search later in an item for prose.
|
|
6
|
+
|
|
7
|
+
The `title_case` style checks the first paragraph of each item, capitalizing major words and keeping internal `MinorWords` lowercase. First and last words require capitals. It skips paragraphs containing opaque inline content such as code, images, or HTML, except that lowercase literal openings are reported without correction.
|
|
8
|
+
|
|
9
|
+
`IgnoredWords` exempts exact, case-sensitive words; in initial styles, exempt items neither establish nor match a baseline. `PreserveMixedCase: true` preserves brands and acronyms such as `macOS` and `API` without establishing a consistency baseline. Set it to `false` to check their initials normally; this does not lowercase internal capitals. `MinorWords` replaces the defaults, matches case-insensitively, and affects only title case. An empty list requires every word to be capitalized. Ignored words take precedence over other checks.
|
|
10
|
+
|
|
11
|
+
Supports unsafe autocorrection with `rubocop -A`, since casing can change proper names or identifiers. Initial-style corrections replace only the first letter. Title-case corrections require a unique, contiguous source mapping outside protected inline syntax; split formatting, links, encoded entities, and multiline text may remain report-only. Container markers, task checkboxes, nested lists, and later paragraphs are preserved.
|
|
12
|
+
|
|
13
|
+
## Configuration
|
|
14
|
+
|
|
15
|
+
```yaml
|
|
16
|
+
Markdown/ListItemCapitalization:
|
|
17
|
+
Enabled: false
|
|
18
|
+
Style: consistent
|
|
19
|
+
PreserveMixedCase: true
|
|
20
|
+
IgnoredWords: []
|
|
21
|
+
MinorWords:
|
|
22
|
+
- a
|
|
23
|
+
- an
|
|
24
|
+
- and
|
|
25
|
+
- as
|
|
26
|
+
- at
|
|
27
|
+
- but
|
|
28
|
+
- by
|
|
29
|
+
- for
|
|
30
|
+
- from
|
|
31
|
+
- in
|
|
32
|
+
- nor
|
|
33
|
+
- of
|
|
34
|
+
- 'on'
|
|
35
|
+
- or
|
|
36
|
+
- per
|
|
37
|
+
- the
|
|
38
|
+
- to
|
|
39
|
+
- via
|
|
40
|
+
- vs
|
|
41
|
+
- with
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Consistent Initials
|
|
45
|
+
|
|
46
|
+
### Bad
|
|
47
|
+
|
|
48
|
+
```markdown
|
|
49
|
+
- Build the package
|
|
50
|
+
- run the tests.
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Good
|
|
54
|
+
|
|
55
|
+
```markdown
|
|
56
|
+
- Build the package
|
|
57
|
+
- Run the tests.
|
|
58
|
+
- check the output
|
|
59
|
+
- review the logs
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Initial Capitals
|
|
63
|
+
|
|
64
|
+
For this configuration:
|
|
65
|
+
|
|
66
|
+
```yaml
|
|
67
|
+
Markdown/ListItemCapitalization:
|
|
68
|
+
Enabled: true
|
|
69
|
+
Style: initial_capital
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Bad
|
|
73
|
+
|
|
74
|
+
```markdown
|
|
75
|
+
- build the package
|
|
76
|
+
- run the tests
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Good
|
|
80
|
+
|
|
81
|
+
```markdown
|
|
82
|
+
- Build the package
|
|
83
|
+
- Run the tests
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Title Case and Word Settings
|
|
87
|
+
|
|
88
|
+
For this configuration:
|
|
89
|
+
|
|
90
|
+
```yaml
|
|
91
|
+
Markdown/ListItemCapitalization:
|
|
92
|
+
Enabled: true
|
|
93
|
+
Style: title_case
|
|
94
|
+
PreserveMixedCase: false
|
|
95
|
+
IgnoredWords:
|
|
96
|
+
- macOS
|
|
97
|
+
- npm
|
|
98
|
+
MinorWords:
|
|
99
|
+
- the
|
|
100
|
+
- with
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Bad
|
|
104
|
+
|
|
105
|
+
```markdown
|
|
106
|
+
- getting started with macOS
|
|
107
|
+
- Using The API with npm
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Good
|
|
111
|
+
|
|
112
|
+
```markdown
|
|
113
|
+
- Getting Started with macOS
|
|
114
|
+
- Using the API with npm
|
|
115
|
+
```
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Markdown/ListItemPunctuation
|
|
2
|
+
|
|
3
|
+
Requires, forbids, or consistently uses terminal punctuation in parsed Markdown list items. Terminal punctuation is a period, exclamation mark, question mark, or ellipsis. Punctuation characters may differ; for example, a question and a statement are consistent. A closing quotation mark after punctuation is allowed. Inline Markdown formatting does not affect the check.
|
|
4
|
+
|
|
5
|
+
With `Style: consistent`, the first item sets the expected style. `always` requires terminal punctuation on every checked item, including single-item lists; `never` forbids it. Nested lists are checked independently. The cop reports only and checks a list only when every item consists of one parsed paragraph; items with code blocks, multiple blocks, or other ambiguous structure are skipped.
|
|
6
|
+
|
|
7
|
+
## Configuration
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
Markdown/ListItemPunctuation:
|
|
11
|
+
Enabled: false
|
|
12
|
+
Style: consistent # consistent, always, or never
|
|
13
|
+
AllowedPunctuation:
|
|
14
|
+
- "."
|
|
15
|
+
- "!"
|
|
16
|
+
- "?"
|
|
17
|
+
- "…"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`AllowedPunctuation` restricts the recognized terminal characters (`.`, `!`, `?`, and `…`). Every character in the terminal punctuation sequence must be allowed, so a period-only policy rejects both `.?` and `?.`. It does not introduce new punctuation characters. In `consistent` mode, this restriction applies to punctuated items without requiring punctuation on an entirely unpunctuated list. `never` forbids all recognized terminal punctuation regardless of this setting.
|
|
21
|
+
|
|
22
|
+
## Example
|
|
23
|
+
|
|
24
|
+
For this configuration:
|
|
25
|
+
|
|
26
|
+
```yaml
|
|
27
|
+
Markdown/ListItemPunctuation:
|
|
28
|
+
Enabled: true
|
|
29
|
+
Style: always
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Bad
|
|
33
|
+
|
|
34
|
+
```markdown
|
|
35
|
+
- Build the package
|
|
36
|
+
- Run the tests
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Good
|
|
40
|
+
|
|
41
|
+
```markdown
|
|
42
|
+
- Build the package.
|
|
43
|
+
- Is it ready?
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Require Periods
|
|
47
|
+
|
|
48
|
+
For this configuration:
|
|
49
|
+
|
|
50
|
+
```yaml
|
|
51
|
+
Markdown/ListItemPunctuation:
|
|
52
|
+
Enabled: true
|
|
53
|
+
Style: always
|
|
54
|
+
AllowedPunctuation:
|
|
55
|
+
- "."
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Bad
|
|
59
|
+
|
|
60
|
+
```markdown
|
|
61
|
+
- Build the package!
|
|
62
|
+
- Run the tests
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Good
|
|
66
|
+
|
|
67
|
+
```markdown
|
|
68
|
+
- Build the package.
|
|
69
|
+
- Run the tests.
|
|
70
|
+
```
|
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
# Markdown/ListMarkerSpacing
|
|
2
2
|
|
|
3
|
-
Enforces spacing
|
|
3
|
+
Enforces one spacing policy for all ordered and unordered list items, whether single-line or multiline. Empty items are ignored when checking spacing.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The `fixed` style requires exactly `MinSpaces` after every marker. The `aligned` style uses `MinSpaces` after the widest actual sibling marker and adds padding after shorter markers so item text aligns when sibling markers have the same indentation. For bullets, whose markers are all one character wide, both styles require `MinSpaces`.
|
|
6
|
+
|
|
7
|
+
Nested lists, separate lists, and lists in different containers are evaluated independently. Empty sibling markers contribute to the width even though their spacing is not checked. Alignment uses source markers, not inferred sequence numbers, and works across wider transitions such as `99.` to `100.`.
|
|
8
|
+
|
|
9
|
+
Autocorrection supports simple one-line items and computed gaps from one to four spaces. Multiline items, items containing nested blocks, and larger gaps are report-only to preserve continuation indentation and item structure. Tabs in a nonempty marker gap are replaced with spaces when correction is safe.
|
|
6
10
|
|
|
7
11
|
## Configuration
|
|
8
12
|
|
|
9
13
|
```yaml
|
|
10
14
|
Markdown/ListMarkerSpacing:
|
|
11
15
|
Enabled: true
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
UnorderedMulti: 1
|
|
15
|
-
OrderedMulti: 1
|
|
16
|
+
Style: fixed
|
|
17
|
+
MinSpaces: 1
|
|
16
18
|
```
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
`Style` accepts `fixed` or `aligned`. `MinSpaces` must be a positive integer. The defaults retain one space after every marker.
|
|
21
|
+
|
|
22
|
+
## Fixed Spacing
|
|
19
23
|
|
|
20
24
|
### Bad
|
|
21
25
|
|
|
@@ -30,3 +34,49 @@ Markdown/ListMarkerSpacing:
|
|
|
30
34
|
- one
|
|
31
35
|
- two
|
|
32
36
|
```
|
|
37
|
+
|
|
38
|
+
## Aligned Spacing
|
|
39
|
+
|
|
40
|
+
For this configuration:
|
|
41
|
+
|
|
42
|
+
```yaml
|
|
43
|
+
Markdown/ListMarkerSpacing:
|
|
44
|
+
Style: aligned
|
|
45
|
+
MinSpaces: 2
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Bad
|
|
49
|
+
|
|
50
|
+
```markdown
|
|
51
|
+
8. Eight
|
|
52
|
+
9. Nine
|
|
53
|
+
10. Ten
|
|
54
|
+
|
|
55
|
+
- Bullet
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Good
|
|
59
|
+
|
|
60
|
+
```markdown
|
|
61
|
+
8. Eight
|
|
62
|
+
9. Nine
|
|
63
|
+
10. Ten
|
|
64
|
+
|
|
65
|
+
- Bullet
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Each gap is the widest sibling marker width minus the current marker width plus `MinSpaces`. Setting `MinSpaces: 1` produces two spaces after `8.` and `9.` and one after `10.` in this example.
|
|
69
|
+
|
|
70
|
+
## Migrating From 0.1.0
|
|
71
|
+
|
|
72
|
+
**Breaking configuration change:** `OrderedSingle`, `OrderedMulti`, `UnorderedSingle`, and `UnorderedMulti` have been removed. RuboCop rejects these keys with migration guidance instead of silently ignoring them.
|
|
73
|
+
|
|
74
|
+
Replace equal legacy values with `Style: fixed` and that value for `MinSpaces`. For example, four legacy settings all set to `2` become:
|
|
75
|
+
|
|
76
|
+
```yaml
|
|
77
|
+
Markdown/ListMarkerSpacing:
|
|
78
|
+
Style: fixed
|
|
79
|
+
MinSpaces: 2
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Different legacy values cannot all be preserved by a single policy; choose the desired shared spacing.
|
|
@@ -9,7 +9,7 @@ Autocorrection preserves punctuation. Changes in number width are report-only be
|
|
|
9
9
|
```yaml
|
|
10
10
|
Markdown/OrderedListNumbering:
|
|
11
11
|
Enabled: false
|
|
12
|
-
|
|
12
|
+
Style: sequential # Or ones, requiring every marker to be 1.
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Example
|
|
@@ -27,3 +27,12 @@ Markdown/OrderedListNumbering:
|
|
|
27
27
|
1. one
|
|
28
28
|
2. two
|
|
29
29
|
```
|
|
30
|
+
|
|
31
|
+
## Migrating From 0.1.0
|
|
32
|
+
|
|
33
|
+
Replace `EnforcedStyle` with `Style`:
|
|
34
|
+
|
|
35
|
+
```yaml
|
|
36
|
+
Markdown/OrderedListNumbering:
|
|
37
|
+
Style: sequential
|
|
38
|
+
```
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Markdown/ProperNames
|
|
2
2
|
|
|
3
|
-
Corrects configured names to their canonical capitalization in
|
|
3
|
+
Corrects configured names to their canonical capitalization in Markdown. Matching is case-insensitive, uses whole-word boundaries, and treats punctuation in names literally.
|
|
4
4
|
|
|
5
|
-
Code
|
|
5
|
+
Code spans, code blocks, links, escaped syntax, HTML, and front matter are excluded by default. `CodeBlocks` includes code spans and code-block contents when enabled; fence language labels are never checked. Use [Text/ProperNames](../text/proper_names.md) for literal plain-text files.
|
|
6
6
|
|
|
7
7
|
## Configuration
|
|
8
8
|
|
|
@@ -10,7 +10,7 @@ Code is checked only when enabled.
|
|
|
10
10
|
Markdown/ProperNames:
|
|
11
11
|
Enabled: false
|
|
12
12
|
Names: [] # Canonical spellings; an empty list disables checks.
|
|
13
|
-
CodeBlocks: false #
|
|
13
|
+
CodeBlocks: false # Also check inline code and code-block contents.
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
## Example
|
|
@@ -1,27 +1,120 @@
|
|
|
1
1
|
# Markdown/RawHtml
|
|
2
2
|
|
|
3
|
-
Reports HTML elements outside the configured allowlist, including nested elements and table cells. Only opening tags are checked; comments are ignored.
|
|
3
|
+
Reports HTML elements outside the configured allowlist, including nested elements and table cells. Only opening tags are checked; comments are ignored. Element names and attribute names are case-insensitive.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
`AllowedElements` accepts plain element names and attribute allowlists in the same list. A plain name permits that element with any attributes or none. An attribute list permits zero or more of the listed attributes and rejects every unlisted attribute. Elements not listed are rejected.
|
|
6
|
+
|
|
7
|
+
This is a lint policy, not an HTML sanitizer or security guarantee. Attribute values are not checked, and no automatic correction is offered.
|
|
6
8
|
|
|
7
9
|
## Configuration
|
|
8
10
|
|
|
9
11
|
```yaml
|
|
10
12
|
Markdown/RawHtml:
|
|
11
13
|
Enabled: false
|
|
12
|
-
AllowedElements: []
|
|
14
|
+
AllowedElements: []
|
|
13
15
|
```
|
|
14
16
|
|
|
15
|
-
##
|
|
17
|
+
## Examples
|
|
18
|
+
|
|
19
|
+
### Disallow All HTML
|
|
20
|
+
|
|
21
|
+
For this configuration:
|
|
22
|
+
|
|
23
|
+
```yaml
|
|
24
|
+
Markdown/RawHtml:
|
|
25
|
+
Enabled: true
|
|
26
|
+
AllowedElements: []
|
|
27
|
+
```
|
|
16
28
|
|
|
17
|
-
|
|
29
|
+
#### Bad
|
|
18
30
|
|
|
19
31
|
```markdown
|
|
20
32
|
<b>Important</b>
|
|
33
|
+
|
|
34
|
+
<img src="chart.png" alt="Results">
|
|
21
35
|
```
|
|
22
36
|
|
|
23
|
-
|
|
37
|
+
#### Good
|
|
24
38
|
|
|
25
39
|
```markdown
|
|
26
40
|
**Important**
|
|
41
|
+
|
|
42
|
+

|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Allow an Element with or Without Attributes
|
|
46
|
+
|
|
47
|
+
For this configuration:
|
|
48
|
+
|
|
49
|
+
```yaml
|
|
50
|
+
Markdown/RawHtml:
|
|
51
|
+
Enabled: true
|
|
52
|
+
AllowedElements:
|
|
53
|
+
- br
|
|
54
|
+
- img
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
#### Bad: an Unlisted Element
|
|
58
|
+
|
|
59
|
+
```markdown
|
|
60
|
+
<div>Results</div>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
#### Good: Attributes Are Optional and Unrestricted
|
|
64
|
+
|
|
65
|
+
```markdown
|
|
66
|
+
Text<br>More text.
|
|
67
|
+
|
|
68
|
+
<img src="chart.png" alt="Results">
|
|
69
|
+
|
|
70
|
+
<img src="chart.png" alt="Results" width="320" height="200">
|
|
27
71
|
```
|
|
72
|
+
|
|
73
|
+
### Allow Only Specific Attributes
|
|
74
|
+
|
|
75
|
+
For this configuration:
|
|
76
|
+
|
|
77
|
+
```yaml
|
|
78
|
+
Markdown/RawHtml:
|
|
79
|
+
Enabled: true
|
|
80
|
+
AllowedElements:
|
|
81
|
+
- br
|
|
82
|
+
- img:
|
|
83
|
+
- src
|
|
84
|
+
- alt
|
|
85
|
+
- width
|
|
86
|
+
- height
|
|
87
|
+
- style
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
#### Bad: an Unlisted Attribute, Even Alongside Allowed Ones
|
|
91
|
+
|
|
92
|
+
```markdown
|
|
93
|
+
<img src="chart.png" alt="Results" loading="lazy">
|
|
94
|
+
|
|
95
|
+
<img src="chart.png" width="320" data-note="width=320">
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
#### Good: Zero or More Allowed Attributes
|
|
99
|
+
|
|
100
|
+
```markdown
|
|
101
|
+

|
|
102
|
+
|
|
103
|
+
Text<br>More text.
|
|
104
|
+
|
|
105
|
+
<img>
|
|
106
|
+
|
|
107
|
+
<img src="chart.png" alt="Results">
|
|
108
|
+
|
|
109
|
+
<img src="chart.png" alt="Results" width="320">
|
|
110
|
+
|
|
111
|
+
<img src="chart.png" alt="Results" height="200">
|
|
112
|
+
|
|
113
|
+
<img src="chart.png" alt="Results" style="width: 50%">
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Matching Rules
|
|
117
|
+
|
|
118
|
+
Each attribute-rule entry maps one element name to a list of permitted attribute names. None are required. An empty attribute list permits only tags with no attributes. Attribute values are not checked: `width="320"` and `width="50%"` are both permitted when `width` is listed. `data-note="width=320"` is rejected unless `data-note` itself is listed.
|
|
119
|
+
|
|
120
|
+
Each opening tag is checked independently, including nested elements: allowing `img` does not allow a surrounding `div`. If multiple entries match the same element, satisfying any entry is enough; adding a plain `img` entry therefore removes attribute restrictions for `img`. Keep only the attribute-list entry when attributes must be restricted.
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Reports duplicate reference definitions and, when enabled, unused definitions. All link and image reference forms count as uses; IDs ignore case and repeated whitespace. Footnotes are not checked.
|
|
4
4
|
|
|
5
|
-
Set `
|
|
5
|
+
`Duplicates: forbid` reports every duplicate, including identical definitions. Set `Duplicates: allow_identical` to repeat definitions near their uses while still reporting conflicts. Destinations are compared after decoding Markdown escapes and HTML entities; titles must match exactly. The first definition still determines the link target. `Duplicates: allow` permits all duplicates.
|
|
6
|
+
|
|
7
|
+
Set `Unused: true` to report unused definitions independently of the duplicate policy, including when `Duplicates: allow`. When a definition is both a forbidden duplicate and unused, only the duplicate diagnostic is reported for that definition. `IgnoredDefinitions` exempts normalized IDs from both checks.
|
|
6
8
|
|
|
7
9
|
Report-only: removing definitions can change link targets or remove comments.
|
|
8
10
|
|
|
@@ -11,9 +13,8 @@ Report-only: removing definitions can change link targets or remove comments.
|
|
|
11
13
|
```yaml
|
|
12
14
|
Markdown/ReferenceDefinitions:
|
|
13
15
|
Enabled: true
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
AllowIdenticalDuplicates: false
|
|
16
|
+
Duplicates: forbid # forbid, allow_identical, or allow
|
|
17
|
+
Unused: false
|
|
17
18
|
IgnoredDefinitions: # Allow conventional comment-like definitions, using normalized IDs.
|
|
18
19
|
- "//"
|
|
19
20
|
```
|
|
@@ -34,3 +35,28 @@ Markdown/ReferenceDefinitions:
|
|
|
34
35
|
|
|
35
36
|
[docs]: /guide
|
|
36
37
|
```
|
|
38
|
+
|
|
39
|
+
## Migrating From 0.1.0
|
|
40
|
+
|
|
41
|
+
Rename `CheckUnused` to `Unused`, keeping its value. Replace `CheckDuplicates` and `AllowIdenticalDuplicates` with `Duplicates`:
|
|
42
|
+
|
|
43
|
+
- `CheckDuplicates: false`, regardless of `AllowIdenticalDuplicates`: use `Duplicates: allow`.
|
|
44
|
+
- `CheckDuplicates: true` (or omitted) with `AllowIdenticalDuplicates: true`: use `Duplicates: allow_identical`.
|
|
45
|
+
- `CheckDuplicates: true` (or omitted) with `AllowIdenticalDuplicates: false` (or omitted): use `Duplicates: forbid` (the default).
|
|
46
|
+
|
|
47
|
+
For example, replace:
|
|
48
|
+
|
|
49
|
+
```yaml
|
|
50
|
+
Markdown/ReferenceDefinitions:
|
|
51
|
+
CheckDuplicates: true
|
|
52
|
+
AllowIdenticalDuplicates: true
|
|
53
|
+
CheckUnused: true
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
With:
|
|
57
|
+
|
|
58
|
+
```yaml
|
|
59
|
+
Markdown/ReferenceDefinitions:
|
|
60
|
+
Duplicates: allow_identical
|
|
61
|
+
Unused: true
|
|
62
|
+
```
|
|
@@ -9,7 +9,11 @@ Autocorrection preserves content. Intraword asterisks are not changed to undersc
|
|
|
9
9
|
```yaml
|
|
10
10
|
Markdown/StrongStyle:
|
|
11
11
|
Enabled: true
|
|
12
|
-
Style: consistent
|
|
12
|
+
Style: consistent
|
|
13
|
+
SupportedStyles:
|
|
14
|
+
- consistent
|
|
15
|
+
- asterisk
|
|
16
|
+
- underscore
|
|
13
17
|
```
|
|
14
18
|
|
|
15
19
|
## Example
|
|
@@ -9,12 +9,9 @@ Use [Prose/MaxLength](../prose/max_length.md) for paragraph formatting. Structur
|
|
|
9
9
|
```yaml
|
|
10
10
|
Markdown/StructuralLineLength:
|
|
11
11
|
Enabled: false
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
CodeBlocks: false
|
|
16
|
-
CodeBlockMax: null # Inherit Max.
|
|
17
|
-
Tables: false # Includes delimiter rows when enabled.
|
|
12
|
+
Headings: 80 # Positive character count, or false to disable.
|
|
13
|
+
CodeBlocks: false # Positive character count, or false to disable.
|
|
14
|
+
Tables: false # Positive character count, or false to disable; includes delimiter rows.
|
|
18
15
|
```
|
|
19
16
|
|
|
20
17
|
## Example
|
|
@@ -24,7 +21,7 @@ For this configuration:
|
|
|
24
21
|
```yaml
|
|
25
22
|
Markdown/StructuralLineLength:
|
|
26
23
|
Enabled: true
|
|
27
|
-
|
|
24
|
+
Headings: 12
|
|
28
25
|
```
|
|
29
26
|
|
|
30
27
|
### Bad
|
|
@@ -38,3 +35,30 @@ Markdown/StructuralLineLength:
|
|
|
38
35
|
```markdown
|
|
39
36
|
# Short
|
|
40
37
|
```
|
|
38
|
+
|
|
39
|
+
## Migrating From 0.1.0
|
|
40
|
+
|
|
41
|
+
Each structural element now has one setting: a positive character count enables that element and sets its limit, while `false` disables it. The shared `Max` setting and separate enable/value pairs have been removed. RuboCop reports obsolete old keys with migration guidance; replace them with a per-element width.
|
|
42
|
+
|
|
43
|
+
For example, migrate this configuration:
|
|
44
|
+
|
|
45
|
+
```yaml
|
|
46
|
+
Markdown/StructuralLineLength:
|
|
47
|
+
Max: 80
|
|
48
|
+
Headings: true
|
|
49
|
+
HeadingMax: 120
|
|
50
|
+
CodeBlocks: true
|
|
51
|
+
CodeBlockMax: 100
|
|
52
|
+
Tables: false
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
To this configuration:
|
|
56
|
+
|
|
57
|
+
```yaml
|
|
58
|
+
Markdown/StructuralLineLength:
|
|
59
|
+
Headings: 120
|
|
60
|
+
CodeBlocks: 100
|
|
61
|
+
Tables: false
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The defaults retain 80-character headings while code blocks and tables remain unchecked.
|
|
@@ -9,7 +9,13 @@ Autocorrection preserves cell contents. Removing pipes from single-column tables
|
|
|
9
9
|
```yaml
|
|
10
10
|
Markdown/TablePipes:
|
|
11
11
|
Enabled: true
|
|
12
|
-
Style: consistent
|
|
12
|
+
Style: consistent
|
|
13
|
+
SupportedStyles:
|
|
14
|
+
- consistent
|
|
15
|
+
- leading_and_trailing
|
|
16
|
+
- leading_only
|
|
17
|
+
- trailing_only
|
|
18
|
+
- no_leading_or_trailing
|
|
13
19
|
```
|
|
14
20
|
|
|
15
21
|
## Example
|
|
@@ -9,7 +9,11 @@ Alignment counts source characters, not display width. Empty cells stay empty.
|
|
|
9
9
|
```yaml
|
|
10
10
|
Markdown/TableSpacing:
|
|
11
11
|
Enabled: true
|
|
12
|
-
Style: aligned
|
|
12
|
+
Style: aligned
|
|
13
|
+
SupportedStyles:
|
|
14
|
+
- aligned
|
|
15
|
+
- compact
|
|
16
|
+
- tight
|
|
13
17
|
```
|
|
14
18
|
|
|
15
19
|
## Example
|
|
@@ -10,6 +10,8 @@ Markdown/ThematicBreakStyle:
|
|
|
10
10
|
Style: consistent
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
+
`Style` accepts `consistent`, a literal Markdown thematic break such as `- - -`, or a nonempty array of literal breaks. Each literal must contain at least three matching `*`, `-`, or `_` markers, optionally separated by spaces or tabs, without leading or trailing whitespace. There is no finite `SupportedStyles` list.
|
|
14
|
+
|
|
13
15
|
## Example
|
|
14
16
|
|
|
15
17
|
For this configuration:
|