rubocop-prose 0.1.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 +7 -0
- data/AGENTS.md +13 -0
- data/CHANGELOG.md +82 -0
- data/CONTRIBUTING.md +77 -0
- data/DESIGN.md +51 -0
- data/LICENSE.txt +21 -0
- data/README.md +152 -0
- data/RELEASING.md +32 -0
- data/assets/README.md +3 -0
- data/assets/RUBOCOP-LICENSE +20 -0
- data/assets/logo.gif +0 -0
- data/assets/logo.png +0 -0
- data/assets/logo.svg +80 -0
- data/assets/rubocop-logo.svg +1 -0
- data/config/cops/markdown/atx_heading_space.yml +3 -0
- data/config/cops/markdown/atx_heading_spacing.yml +3 -0
- data/config/cops/markdown/bare_url.yml +7 -0
- data/config/cops/markdown/blockquote_blank_lines.yml +3 -0
- data/config/cops/markdown/blockquote_spacing.yml +3 -0
- data/config/cops/markdown/closed_heading_space.yml +3 -0
- data/config/cops/markdown/closed_heading_spacing.yml +3 -0
- data/config/cops/markdown/code_block_style.yml +8 -0
- data/config/cops/markdown/code_span_spacing.yml +3 -0
- data/config/cops/markdown/compact_lists.yml +3 -0
- data/config/cops/markdown/descriptive_link_text.yml +8 -0
- data/config/cops/markdown/duplicate_headings.yml +4 -0
- data/config/cops/markdown/emphasis_heading.yml +3 -0
- data/config/cops/markdown/emphasis_spacing.yml +3 -0
- data/config/cops/markdown/emphasis_style.yml +4 -0
- data/config/cops/markdown/empty_link.yml +3 -0
- data/config/cops/markdown/fence_blank_lines.yml +6 -0
- data/config/cops/markdown/fence_language.yml +4 -0
- data/config/cops/markdown/fence_style.yml +8 -0
- data/config/cops/markdown/first_heading.yml +6 -0
- data/config/cops/markdown/front_matter.yml +2 -0
- data/config/cops/markdown/hard_break_style.yml +4 -0
- data/config/cops/markdown/hard_tabs.yml +5 -0
- data/config/cops/markdown/heading_blank_lines.yml +5 -0
- data/config/cops/markdown/heading_increment.yml +3 -0
- data/config/cops/markdown/heading_indentation.yml +3 -0
- data/config/cops/markdown/heading_punctuation.yml +4 -0
- data/config/cops/markdown/heading_structure.yml +4 -0
- data/config/cops/markdown/heading_style.yml +9 -0
- data/config/cops/markdown/image_alt_text.yml +3 -0
- data/config/cops/markdown/image_path_separators.yml +3 -0
- data/config/cops/markdown/link_fragment.yml +6 -0
- data/config/cops/markdown/link_style.yml +10 -0
- data/config/cops/markdown/link_text_spacing.yml +3 -0
- data/config/cops/markdown/list_blank_lines.yml +3 -0
- data/config/cops/markdown/list_continuation_indentation.yml +3 -0
- data/config/cops/markdown/list_indentation.yml +3 -0
- data/config/cops/markdown/list_marker_spacing.yml +7 -0
- data/config/cops/markdown/ordered_list_numbering.yml +7 -0
- data/config/cops/markdown/outside_spacing.yml +3 -0
- data/config/cops/markdown/proper_names.yml +5 -0
- data/config/cops/markdown/raw_html.yml +4 -0
- data/config/cops/markdown/reference_definitions.yml +8 -0
- data/config/cops/markdown/reversed_link.yml +3 -0
- data/config/cops/markdown/shell_prompts.yml +13 -0
- data/config/cops/markdown/single_top_level_heading.yml +4 -0
- data/config/cops/markdown/strong_style.yml +4 -0
- data/config/cops/markdown/structural_line_length.yml +9 -0
- data/config/cops/markdown/syntax.yml +3 -0
- data/config/cops/markdown/table_blank_lines.yml +3 -0
- data/config/cops/markdown/table_columns.yml +3 -0
- data/config/cops/markdown/table_pipes.yml +4 -0
- data/config/cops/markdown/table_spacing.yml +4 -0
- data/config/cops/markdown/thematic_break_blank_lines.yml +5 -0
- data/config/cops/markdown/thematic_break_style.yml +4 -0
- data/config/cops/markdown/trailing_whitespace.yml +5 -0
- data/config/cops/markdown/unclosed_fenced_code_block.yml +3 -0
- data/config/cops/markdown/undefined_reference.yml +4 -0
- data/config/cops/markdown/unordered_list_indentation.yml +4 -0
- data/config/cops/markdown/unordered_list_marker.yml +9 -0
- data/config/cops/prose/max_length.yml +5 -0
- data/config/cops/prose/multiple_blank_lines.yml +4 -0
- data/config/cops/prose/trailing_newline.yml +3 -0
- data/config/cops/text/trailing_whitespace.yml +3 -0
- data/config/default.yml +16 -0
- data/docs/cops/markdown/atx_heading_space.md +26 -0
- data/docs/cops/markdown/atx_heading_spacing.md +24 -0
- data/docs/cops/markdown/bare_url.md +30 -0
- data/docs/cops/markdown/blockquote_blank_lines.md +30 -0
- data/docs/cops/markdown/blockquote_spacing.md +30 -0
- data/docs/cops/markdown/closed_heading_space.md +26 -0
- data/docs/cops/markdown/closed_heading_spacing.md +24 -0
- data/docs/cops/markdown/code_block_style.md +37 -0
- data/docs/cops/markdown/code_span_spacing.md +26 -0
- data/docs/cops/markdown/compact_lists.md +29 -0
- data/docs/cops/markdown/descriptive_link_text.md +31 -0
- data/docs/cops/markdown/duplicate_headings.md +35 -0
- data/docs/cops/markdown/emphasis_heading.md +26 -0
- data/docs/cops/markdown/emphasis_spacing.md +24 -0
- data/docs/cops/markdown/emphasis_style.md +34 -0
- data/docs/cops/markdown/empty_link.md +26 -0
- data/docs/cops/markdown/fence_blank_lines.md +43 -0
- data/docs/cops/markdown/fence_language.md +31 -0
- data/docs/cops/markdown/fence_style.md +38 -0
- data/docs/cops/markdown/first_heading.md +31 -0
- data/docs/cops/markdown/hard_break_style.md +50 -0
- data/docs/cops/markdown/hard_tabs.md +30 -0
- data/docs/cops/markdown/heading_blank_lines.md +36 -0
- data/docs/cops/markdown/heading_increment.md +30 -0
- data/docs/cops/markdown/heading_indentation.md +26 -0
- data/docs/cops/markdown/heading_punctuation.md +27 -0
- data/docs/cops/markdown/heading_structure.md +41 -0
- data/docs/cops/markdown/heading_style.md +36 -0
- data/docs/cops/markdown/image_alt_text.md +26 -0
- data/docs/cops/markdown/image_path_separators.md +32 -0
- data/docs/cops/markdown/link_fragment.md +35 -0
- data/docs/cops/markdown/link_style.md +49 -0
- data/docs/cops/markdown/link_text_spacing.md +26 -0
- data/docs/cops/markdown/list_blank_lines.md +31 -0
- data/docs/cops/markdown/list_continuation_indentation.md +28 -0
- data/docs/cops/markdown/list_indentation.md +28 -0
- data/docs/cops/markdown/list_marker_spacing.md +32 -0
- data/docs/cops/markdown/ordered_list_numbering.md +29 -0
- data/docs/cops/markdown/outside_spacing.md +26 -0
- data/docs/cops/markdown/proper_names.md +39 -0
- data/docs/cops/markdown/raw_html.md +27 -0
- data/docs/cops/markdown/reference_definitions.md +36 -0
- data/docs/cops/markdown/reversed_link.md +26 -0
- data/docs/cops/markdown/shell_prompts.md +57 -0
- data/docs/cops/markdown/single_top_level_heading.md +31 -0
- data/docs/cops/markdown/strong_style.md +34 -0
- data/docs/cops/markdown/structural_line_length.md +40 -0
- data/docs/cops/markdown/syntax.md +28 -0
- data/docs/cops/markdown/table_blank_lines.md +34 -0
- data/docs/cops/markdown/table_columns.md +30 -0
- data/docs/cops/markdown/table_pipes.md +38 -0
- data/docs/cops/markdown/table_spacing.md +38 -0
- data/docs/cops/markdown/thematic_break_blank_lines.md +31 -0
- data/docs/cops/markdown/thematic_break_style.md +48 -0
- data/docs/cops/markdown/trailing_whitespace.md +30 -0
- data/docs/cops/markdown/unclosed_fenced_code_block.md +29 -0
- data/docs/cops/markdown/undefined_reference.md +29 -0
- data/docs/cops/markdown/unordered_list_indentation.md +45 -0
- data/docs/cops/markdown/unordered_list_marker.md +36 -0
- data/docs/cops/prose/max_length.md +33 -0
- data/docs/cops/prose/multiple_blank_lines.md +50 -0
- data/docs/cops/prose/trailing_newline.md +26 -0
- data/docs/cops/text/trailing_whitespace.md +26 -0
- data/docs/settings/files.md +33 -0
- data/docs/settings/front_matter.md +12 -0
- data/lib/rubocop/cop/markdown/atx_heading_space.rb +22 -0
- data/lib/rubocop/cop/markdown/atx_heading_spacing.rb +27 -0
- data/lib/rubocop/cop/markdown/bare_url.rb +22 -0
- data/lib/rubocop/cop/markdown/base.rb +17 -0
- data/lib/rubocop/cop/markdown/blockquote_blank_lines.rb +49 -0
- data/lib/rubocop/cop/markdown/blockquote_spacing.rb +76 -0
- data/lib/rubocop/cop/markdown/closed_heading_space.rb +26 -0
- data/lib/rubocop/cop/markdown/closed_heading_spacing.rb +27 -0
- data/lib/rubocop/cop/markdown/code_block_style.rb +80 -0
- data/lib/rubocop/cop/markdown/code_span_spacing.rb +51 -0
- data/lib/rubocop/cop/markdown/compact_lists.rb +43 -0
- data/lib/rubocop/cop/markdown/descriptive_link_text.rb +27 -0
- data/lib/rubocop/cop/markdown/duplicate_headings.rb +28 -0
- data/lib/rubocop/cop/markdown/emphasis_heading.rb +18 -0
- data/lib/rubocop/cop/markdown/emphasis_spacing.rb +30 -0
- data/lib/rubocop/cop/markdown/emphasis_style.rb +34 -0
- data/lib/rubocop/cop/markdown/empty_link.rb +25 -0
- data/lib/rubocop/cop/markdown/fence_blank_lines.rb +72 -0
- data/lib/rubocop/cop/markdown/fence_language.rb +32 -0
- data/lib/rubocop/cop/markdown/fence_style.rb +39 -0
- data/lib/rubocop/cop/markdown/first_heading.rb +44 -0
- data/lib/rubocop/cop/markdown/hard_break_style.rb +65 -0
- data/lib/rubocop/cop/markdown/hard_tabs.rb +32 -0
- data/lib/rubocop/cop/markdown/heading_blank_lines.rb +37 -0
- data/lib/rubocop/cop/markdown/heading_increment.rb +23 -0
- data/lib/rubocop/cop/markdown/heading_indentation.rb +37 -0
- data/lib/rubocop/cop/markdown/heading_punctuation.rb +23 -0
- data/lib/rubocop/cop/markdown/heading_structure.rb +33 -0
- data/lib/rubocop/cop/markdown/heading_style.rb +24 -0
- data/lib/rubocop/cop/markdown/image_alt_text.rb +24 -0
- data/lib/rubocop/cop/markdown/image_path_separators.rb +32 -0
- data/lib/rubocop/cop/markdown/link_fragment.rb +36 -0
- data/lib/rubocop/cop/markdown/link_style.rb +29 -0
- data/lib/rubocop/cop/markdown/link_text_spacing.rb +34 -0
- data/lib/rubocop/cop/markdown/list_blank_lines.rb +38 -0
- data/lib/rubocop/cop/markdown/list_continuation_indentation.rb +59 -0
- data/lib/rubocop/cop/markdown/list_indentation.rb +28 -0
- data/lib/rubocop/cop/markdown/list_marker_spacing.rb +44 -0
- data/lib/rubocop/cop/markdown/ordered_list_numbering.rb +35 -0
- data/lib/rubocop/cop/markdown/outside_spacing.rb +88 -0
- data/lib/rubocop/cop/markdown/proper_names.rb +51 -0
- data/lib/rubocop/cop/markdown/raw_html.rb +60 -0
- data/lib/rubocop/cop/markdown/reference_definitions.rb +37 -0
- data/lib/rubocop/cop/markdown/reversed_link.rb +20 -0
- data/lib/rubocop/cop/markdown/shell_prompts.rb +72 -0
- data/lib/rubocop/cop/markdown/single_top_level_heading.rb +19 -0
- data/lib/rubocop/cop/markdown/strong_style.rb +33 -0
- data/lib/rubocop/cop/markdown/structural_line_length.rb +51 -0
- data/lib/rubocop/cop/markdown/syntax.rb +33 -0
- data/lib/rubocop/cop/markdown/table_blank_lines.rb +46 -0
- data/lib/rubocop/cop/markdown/table_columns.rb +23 -0
- data/lib/rubocop/cop/markdown/table_pipes.rb +45 -0
- data/lib/rubocop/cop/markdown/table_spacing.rb +62 -0
- data/lib/rubocop/cop/markdown/thematic_break_blank_lines.rb +115 -0
- data/lib/rubocop/cop/markdown/thematic_break_style.rb +74 -0
- data/lib/rubocop/cop/markdown/trailing_whitespace.rb +55 -0
- data/lib/rubocop/cop/markdown/unclosed_fenced_code_block.rb +82 -0
- data/lib/rubocop/cop/markdown/undefined_reference.rb +25 -0
- data/lib/rubocop/cop/markdown/unordered_list_indentation.rb +37 -0
- data/lib/rubocop/cop/markdown/unordered_list_marker.rb +45 -0
- data/lib/rubocop/cop/prose/base.rb +55 -0
- data/lib/rubocop/cop/prose/max_length.rb +93 -0
- data/lib/rubocop/cop/prose/multiple_blank_lines.rb +96 -0
- data/lib/rubocop/cop/prose/trailing_newline.rb +26 -0
- data/lib/rubocop/cop/text/base.rb +17 -0
- data/lib/rubocop/cop/text/trailing_whitespace.rb +25 -0
- data/lib/rubocop/prose/code_rules.rb +79 -0
- data/lib/rubocop/prose/document.rb +62 -0
- data/lib/rubocop/prose/file_types.rb +56 -0
- data/lib/rubocop/prose/heading_rules.rb +54 -0
- data/lib/rubocop/prose/inline_rules.rb +213 -0
- data/lib/rubocop/prose/link_rules.rb +630 -0
- data/lib/rubocop/prose/list_rules.rb +65 -0
- data/lib/rubocop/prose/markdown_document.rb +167 -0
- data/lib/rubocop/prose/parser.rb +80 -0
- data/lib/rubocop/prose/plugin.rb +30 -0
- data/lib/rubocop/prose/runner.rb +63 -0
- data/lib/rubocop/prose/source.rb +82 -0
- data/lib/rubocop/prose/structural_blank_lines.rb +90 -0
- data/lib/rubocop/prose/table_rules.rb +71 -0
- data/lib/rubocop/prose/text_document.rb +54 -0
- data/lib/rubocop/prose/version.rb +7 -0
- data/lib/rubocop-prose.rb +30 -0
- metadata +335 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Markdown/ImageAltText
|
|
2
|
+
|
|
3
|
+
Requires nonblank alternative text for Markdown images, including reference images and images inside links.
|
|
4
|
+
|
|
5
|
+
Report-only: add a meaningful description inside the brackets.
|
|
6
|
+
|
|
7
|
+
## Configuration
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
Markdown/ImageAltText:
|
|
11
|
+
Enabled: true
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Example
|
|
15
|
+
|
|
16
|
+
### Bad
|
|
17
|
+
|
|
18
|
+
```markdown
|
|
19
|
+

|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Good
|
|
23
|
+
|
|
24
|
+
```markdown
|
|
25
|
+

|
|
26
|
+
```
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Markdown/ImagePathSeparators
|
|
2
|
+
|
|
3
|
+
Checks local image destinations for backslashes used as path separators. The check applies to inline images and resolved reference-style images; ordinary links and unresolved references are not checked.
|
|
4
|
+
|
|
5
|
+
The cop corrects clear separators to forward slashes. Backslashes before Markdown-escapable ASCII punctuation, such as the parentheses in `diagram\(v2\).png`, are preserved. Consecutive backslashes before a path component are reported without correction because their intended meaning is ambiguous. External URI destinations are left unchanged.
|
|
6
|
+
|
|
7
|
+
## Configuration
|
|
8
|
+
|
|
9
|
+
Enabled by default with no options.
|
|
10
|
+
|
|
11
|
+
## Example
|
|
12
|
+
|
|
13
|
+
### Bad
|
|
14
|
+
|
|
15
|
+
```markdown
|
|
16
|
+

|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Good
|
|
20
|
+
|
|
21
|
+
```markdown
|
|
22
|
+

|
|
23
|
+
|
|
24
|
+
.png)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
For this configuration:
|
|
28
|
+
|
|
29
|
+
```yaml
|
|
30
|
+
Markdown/ImagePathSeparators:
|
|
31
|
+
Enabled: false
|
|
32
|
+
```
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Markdown/LinkFragment
|
|
2
|
+
|
|
3
|
+
Checks links beginning with `#` against headings and explicit anchors in the same document. Matching is case-sensitive and decodes entities and percent escapes; `+` stays literal.
|
|
4
|
+
|
|
5
|
+
`Renderer` selects approximate GitHub, GitLab, or Kramdown heading IDs. GitLab collapses repeated hyphens; Kramdown uses ASCII IDs. Duplicate headings receive numbered suffixes. Explicit heading IDs, HTML `id` attributes, and HTML anchor `name` attributes are accepted.
|
|
6
|
+
|
|
7
|
+
Report-only. Page-top links are configured independently of [Markdown/EmptyLink](empty_link.md).
|
|
8
|
+
|
|
9
|
+
## Configuration
|
|
10
|
+
|
|
11
|
+
```yaml
|
|
12
|
+
Markdown/LinkFragment:
|
|
13
|
+
Enabled: false
|
|
14
|
+
Renderer: github # Also supports gitlab and kramdown.
|
|
15
|
+
AdditionalAnchors: [] # Case-sensitive IDs supplied by the site's renderer or template.
|
|
16
|
+
AllowEmptyFragment: true # Allow # as a page-top link.
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Example
|
|
20
|
+
|
|
21
|
+
### Bad
|
|
22
|
+
|
|
23
|
+
```markdown
|
|
24
|
+
# Installation
|
|
25
|
+
|
|
26
|
+
[Install](#missing)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Good
|
|
30
|
+
|
|
31
|
+
```markdown
|
|
32
|
+
# Installation
|
|
33
|
+
|
|
34
|
+
[Install](#installation)
|
|
35
|
+
```
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Markdown/LinkStyle
|
|
2
|
+
|
|
3
|
+
Restricts link and image styles independently, including images nested in links.
|
|
4
|
+
|
|
5
|
+
Use `inline`, `reference`, or individual reference forms: `full_reference`, `collapsed_reference`, and `shortcut_reference`. Links also support `autolink` for angle-bracketed URLs and email addresses. Bare URLs belong to [Markdown/BareUrl](bare_url.md).
|
|
6
|
+
|
|
7
|
+
Report-only: changing styles may require new labels or definitions.
|
|
8
|
+
|
|
9
|
+
## Configuration
|
|
10
|
+
|
|
11
|
+
```yaml
|
|
12
|
+
Markdown/LinkStyle:
|
|
13
|
+
Enabled: false
|
|
14
|
+
AllowedLinkStyles: # An empty list prohibits all link syntax.
|
|
15
|
+
- inline
|
|
16
|
+
- reference
|
|
17
|
+
- autolink
|
|
18
|
+
AllowedImageStyles: # An empty list prohibits all image syntax.
|
|
19
|
+
- inline
|
|
20
|
+
- reference
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Example
|
|
24
|
+
|
|
25
|
+
For this configuration:
|
|
26
|
+
|
|
27
|
+
```yaml
|
|
28
|
+
Markdown/LinkStyle:
|
|
29
|
+
Enabled: true
|
|
30
|
+
AllowedLinkStyles:
|
|
31
|
+
- reference
|
|
32
|
+
- autolink
|
|
33
|
+
AllowedImageStyles:
|
|
34
|
+
- inline
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Bad
|
|
38
|
+
|
|
39
|
+
```markdown
|
|
40
|
+
[Read the guide](/guide)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Good
|
|
44
|
+
|
|
45
|
+
```markdown
|
|
46
|
+
[Read the guide][docs]
|
|
47
|
+
|
|
48
|
+
[docs]: /guide
|
|
49
|
+
```
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Markdown/LinkTextSpacing
|
|
2
|
+
|
|
3
|
+
Trims leading and trailing whitespace from inline and reference link labels without changing their targets. Images and autolinks are not checked.
|
|
4
|
+
|
|
5
|
+
Whitespace-only labels are report-only because trimming them could change the link syntax.
|
|
6
|
+
|
|
7
|
+
## Configuration
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
Markdown/LinkTextSpacing:
|
|
11
|
+
Enabled: true
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Example
|
|
15
|
+
|
|
16
|
+
### Bad
|
|
17
|
+
|
|
18
|
+
```markdown
|
|
19
|
+
[ guide ](/guide)
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Good
|
|
23
|
+
|
|
24
|
+
```markdown
|
|
25
|
+
[guide](/guide)
|
|
26
|
+
```
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Markdown/ListBlankLines
|
|
2
|
+
|
|
3
|
+
Adds blank lines around lists, preserving blockquote nesting. Document boundaries and a preceding front-matter header do not require padding.
|
|
4
|
+
|
|
5
|
+
Nested lists need no separation from their parent items. Continuation text within an item is not content after the list.
|
|
6
|
+
|
|
7
|
+
## Configuration
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
Markdown/ListBlankLines:
|
|
11
|
+
Enabled: true
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Example
|
|
15
|
+
|
|
16
|
+
### Bad
|
|
17
|
+
|
|
18
|
+
```markdown
|
|
19
|
+
# Items
|
|
20
|
+
- one
|
|
21
|
+
- two
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Good
|
|
25
|
+
|
|
26
|
+
```markdown
|
|
27
|
+
# Items
|
|
28
|
+
|
|
29
|
+
- one
|
|
30
|
+
- two
|
|
31
|
+
```
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Markdown/ListContinuationIndentation
|
|
2
|
+
|
|
3
|
+
Requires continuation lines in parsed list-item paragraphs to align with the item's content column. This checks indentation only; it does not require paragraph reflow or sibling marker alignment.
|
|
4
|
+
|
|
5
|
+
## Configuration
|
|
6
|
+
|
|
7
|
+
Enabled by default. This cop reports offenses without autocorrection because changing indentation can alter which Markdown item or block owns the text.
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
Markdown/ListContinuationIndentation:
|
|
11
|
+
Enabled: true
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Example
|
|
15
|
+
|
|
16
|
+
### Bad
|
|
17
|
+
|
|
18
|
+
```markdown
|
|
19
|
+
- Item text
|
|
20
|
+
continued text.
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Good
|
|
24
|
+
|
|
25
|
+
```markdown
|
|
26
|
+
- Item text
|
|
27
|
+
continued text.
|
|
28
|
+
```
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Markdown/ListIndentation
|
|
2
|
+
|
|
3
|
+
Requires sibling markers to align with the first item in each ordered or unordered list. Nested lists are checked independently; blockquote prefixes do not count toward indentation.
|
|
4
|
+
|
|
5
|
+
Indentation counts source characters, not tab stops. Report-only: moving a marker could change which content belongs to the item.
|
|
6
|
+
|
|
7
|
+
## Configuration
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
Markdown/ListIndentation:
|
|
11
|
+
Enabled: true
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Example
|
|
15
|
+
|
|
16
|
+
### Bad
|
|
17
|
+
|
|
18
|
+
```markdown
|
|
19
|
+
- one
|
|
20
|
+
- two
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Good
|
|
24
|
+
|
|
25
|
+
```markdown
|
|
26
|
+
- one
|
|
27
|
+
- two
|
|
28
|
+
```
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Markdown/ListMarkerSpacing
|
|
2
|
+
|
|
3
|
+
Enforces spacing after list markers. A list uses its `Multi` setting if any item spans multiple lines, including nested content; otherwise it uses `Single`. Empty items are ignored.
|
|
4
|
+
|
|
5
|
+
Autocorrection supports simple one-line items and widths from one to four spaces. Other cases are report-only to preserve item structure.
|
|
6
|
+
|
|
7
|
+
## Configuration
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
Markdown/ListMarkerSpacing:
|
|
11
|
+
Enabled: true
|
|
12
|
+
UnorderedSingle: 1
|
|
13
|
+
OrderedSingle: 1
|
|
14
|
+
UnorderedMulti: 1
|
|
15
|
+
OrderedMulti: 1
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Example
|
|
19
|
+
|
|
20
|
+
### Bad
|
|
21
|
+
|
|
22
|
+
```markdown
|
|
23
|
+
- one
|
|
24
|
+
- two
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Good
|
|
28
|
+
|
|
29
|
+
```markdown
|
|
30
|
+
- one
|
|
31
|
+
- two
|
|
32
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Markdown/OrderedListNumbering
|
|
2
|
+
|
|
3
|
+
Enforces sequential numbering or repeated ones. Sequential numbering starts at each list's first number, including zero; nested and quoted lists are checked independently.
|
|
4
|
+
|
|
5
|
+
Autocorrection preserves punctuation. Changes in number width are report-only because they can affect continuation indentation.
|
|
6
|
+
|
|
7
|
+
## Configuration
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
Markdown/OrderedListNumbering:
|
|
11
|
+
Enabled: false
|
|
12
|
+
EnforcedStyle: sequential # Or ones, requiring every marker to be 1.
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Example
|
|
16
|
+
|
|
17
|
+
### Bad
|
|
18
|
+
|
|
19
|
+
```markdown
|
|
20
|
+
1. one
|
|
21
|
+
1. two
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Good
|
|
25
|
+
|
|
26
|
+
```markdown
|
|
27
|
+
1. one
|
|
28
|
+
2. two
|
|
29
|
+
```
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Markdown/OutsideSpacing
|
|
2
|
+
|
|
3
|
+
Reports inline code and emphasis that directly touch a neighboring prose word. It checks Unicode letters and numbers using original character positions and leaves boundaries in scripts commonly written without spaces, such as CJK, unchanged.
|
|
4
|
+
|
|
5
|
+
The cop reports only and never inserts spaces: source text cannot establish whether adjoining letters form separate words or intentional intraword formatting, and changing adjacency can alter meaning. Such cases are left as written and can be resolved by editing the source or disabling this cop for the relevant files.
|
|
6
|
+
|
|
7
|
+
## Configuration
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
Markdown/OutsideSpacing:
|
|
11
|
+
Enabled: true
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Example
|
|
15
|
+
|
|
16
|
+
### Bad
|
|
17
|
+
|
|
18
|
+
```markdown
|
|
19
|
+
Use`command`now; read**important**text.
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Good
|
|
23
|
+
|
|
24
|
+
```markdown
|
|
25
|
+
Use `command` now; read **important** text.
|
|
26
|
+
```
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Markdown/ProperNames
|
|
2
|
+
|
|
3
|
+
Corrects configured names to their canonical capitalization in prose, headings, and tables. Matching is case-insensitive, uses whole-word boundaries, and treats punctuation in names literally.
|
|
4
|
+
|
|
5
|
+
Code is checked only when enabled.
|
|
6
|
+
|
|
7
|
+
## Configuration
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
Markdown/ProperNames:
|
|
11
|
+
Enabled: false
|
|
12
|
+
Names: [] # Canonical spellings; an empty list disables checks.
|
|
13
|
+
CodeBlocks: false # Set true to check inline code and code blocks, but never fence info strings.
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Example
|
|
17
|
+
|
|
18
|
+
For this configuration:
|
|
19
|
+
|
|
20
|
+
```yaml
|
|
21
|
+
Markdown/ProperNames:
|
|
22
|
+
Enabled: true
|
|
23
|
+
Names:
|
|
24
|
+
- GitHub
|
|
25
|
+
- Ruby
|
|
26
|
+
- C++
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Bad
|
|
30
|
+
|
|
31
|
+
```markdown
|
|
32
|
+
Use github and ruby.
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Good
|
|
36
|
+
|
|
37
|
+
```markdown
|
|
38
|
+
Use GitHub and Ruby.
|
|
39
|
+
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Markdown/RawHtml
|
|
2
|
+
|
|
3
|
+
Reports HTML elements outside the configured allowlist, including nested elements and table cells. Only opening tags are checked; comments are ignored.
|
|
4
|
+
|
|
5
|
+
Report-only: removing HTML can discard content or structure.
|
|
6
|
+
|
|
7
|
+
## Configuration
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
Markdown/RawHtml:
|
|
11
|
+
Enabled: false
|
|
12
|
+
AllowedElements: [] # Case-insensitive element names without angle brackets.
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Example
|
|
16
|
+
|
|
17
|
+
### Bad
|
|
18
|
+
|
|
19
|
+
```markdown
|
|
20
|
+
<b>Important</b>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Good
|
|
24
|
+
|
|
25
|
+
```markdown
|
|
26
|
+
**Important**
|
|
27
|
+
```
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Markdown/ReferenceDefinitions
|
|
2
|
+
|
|
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
|
+
|
|
5
|
+
Set `AllowIdenticalDuplicates: true` to repeat definitions near their uses while still reporting conflicts. Destinations are compared after decoding Markdown escapes and HTML entities; titles must also match. The first definition still determines the link target. Unused-definition checking remains independent.
|
|
6
|
+
|
|
7
|
+
Report-only: removing definitions can change link targets or remove comments.
|
|
8
|
+
|
|
9
|
+
## Configuration
|
|
10
|
+
|
|
11
|
+
```yaml
|
|
12
|
+
Markdown/ReferenceDefinitions:
|
|
13
|
+
Enabled: true
|
|
14
|
+
CheckUnused: false
|
|
15
|
+
CheckDuplicates: true
|
|
16
|
+
AllowIdenticalDuplicates: false
|
|
17
|
+
IgnoredDefinitions: # Allow conventional comment-like definitions, using normalized IDs.
|
|
18
|
+
- "//"
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Example
|
|
22
|
+
|
|
23
|
+
### Bad
|
|
24
|
+
|
|
25
|
+
```markdown
|
|
26
|
+
[docs]: /guide
|
|
27
|
+
[docs]: /another-guide
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Good
|
|
31
|
+
|
|
32
|
+
```markdown
|
|
33
|
+
[Read the guide][docs]
|
|
34
|
+
|
|
35
|
+
[docs]: /guide
|
|
36
|
+
```
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Markdown/ReversedLink
|
|
2
|
+
|
|
3
|
+
Reports reversed link syntax such as `(Documentation)[https://example.test]`. Use `[Documentation](https://example.test)` instead. Valid references and single citation-shaped keys such as `(abbrev)[@citekey]` or `(abbrev)[-@citekey]` are left alone. This is a narrow diagnostic exclusion, not full Pandoc or R Markdown citation support.
|
|
4
|
+
|
|
5
|
+
Report-only: review the intended link before rewriting it.
|
|
6
|
+
|
|
7
|
+
## Configuration
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
Markdown/ReversedLink:
|
|
11
|
+
Enabled: true
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Example
|
|
15
|
+
|
|
16
|
+
### Bad
|
|
17
|
+
|
|
18
|
+
```markdown
|
|
19
|
+
(Read the guide)[/guide]
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Good
|
|
23
|
+
|
|
24
|
+
```markdown
|
|
25
|
+
[Read the guide](/guide)
|
|
26
|
+
```
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Markdown/ShellPrompts
|
|
2
|
+
|
|
3
|
+
Removes leading `$` and `%` prompts followed by a space in shell-language fences by default. Every nonblank line other than a shell comment must start with a configured prompt. Blocks containing output or unprompted continuation lines are left alone; comments, blank lines, and nesting are preserved.
|
|
4
|
+
|
|
5
|
+
`Prompts` is a positive set of literal markers, not an allowed/forbidden pair. An explicit list replaces the defaults. Markers must be nonempty strings without whitespace; the list must contain at least one marker. Language names are case-sensitive.
|
|
6
|
+
|
|
7
|
+
`#` is not a default prompt: shell comments are never stripped. When explicitly configured, `#` prompts are reported, but the entire block remains uncorrected because commands cannot reliably be distinguished from comments. The same safeguard applies to any configured marker beginning with `#`. Corrections are also withheld if removing any prompt could expose a closing fence.
|
|
8
|
+
|
|
9
|
+
## Configuration
|
|
10
|
+
|
|
11
|
+
```yaml
|
|
12
|
+
Markdown/ShellPrompts:
|
|
13
|
+
Enabled: true
|
|
14
|
+
Prompts:
|
|
15
|
+
- '$'
|
|
16
|
+
- '%'
|
|
17
|
+
ShellLanguages: # Case-sensitive fenced language names.
|
|
18
|
+
- bash
|
|
19
|
+
- console
|
|
20
|
+
- ksh
|
|
21
|
+
- sh
|
|
22
|
+
- shell
|
|
23
|
+
- zsh
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Example
|
|
27
|
+
|
|
28
|
+
### Bad
|
|
29
|
+
|
|
30
|
+
````markdown
|
|
31
|
+
```sh
|
|
32
|
+
$ echo hello
|
|
33
|
+
% echo hello
|
|
34
|
+
# Keep this shell comment.
|
|
35
|
+
```
|
|
36
|
+
````
|
|
37
|
+
|
|
38
|
+
### Good
|
|
39
|
+
|
|
40
|
+
````markdown
|
|
41
|
+
```sh
|
|
42
|
+
echo hello
|
|
43
|
+
echo hello
|
|
44
|
+
# Keep this shell comment.
|
|
45
|
+
```
|
|
46
|
+
````
|
|
47
|
+
|
|
48
|
+
For this configuration:
|
|
49
|
+
|
|
50
|
+
```yaml
|
|
51
|
+
Markdown/ShellPrompts:
|
|
52
|
+
Prompts:
|
|
53
|
+
- '%'
|
|
54
|
+
- '#'
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Both `% echo hello` and `# echo hello` are reported in shell-language fences. A block containing `# echo hello` or `# Keep this shell comment.` is report-only; neither line is silently rewritten. `$` is no longer recognized as a prompt with this configuration.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Markdown/SingleTopLevelHeading
|
|
2
|
+
|
|
3
|
+
Allows at most one heading at the configured top level. Front-matter titles do not count; use [Markdown/FirstHeading](first_heading.md) for that policy.
|
|
4
|
+
|
|
5
|
+
Report-only: removing or demoting a heading changes structure.
|
|
6
|
+
|
|
7
|
+
## Configuration
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
Markdown/SingleTopLevelHeading:
|
|
11
|
+
Enabled: false
|
|
12
|
+
Level: 1
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Example
|
|
16
|
+
|
|
17
|
+
### Bad
|
|
18
|
+
|
|
19
|
+
```markdown
|
|
20
|
+
# Guide
|
|
21
|
+
|
|
22
|
+
# Usage
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Good
|
|
26
|
+
|
|
27
|
+
```markdown
|
|
28
|
+
# Guide
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
```
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Markdown/StrongStyle
|
|
2
|
+
|
|
3
|
+
Enforces `**`, `__`, or consistent strong emphasis. Consistent mode follows the first span; ordinary emphasis belongs to [Markdown/EmphasisStyle](emphasis_style.md).
|
|
4
|
+
|
|
5
|
+
Autocorrection preserves content. Intraword asterisks are not changed to underscores when that would remove the formatting.
|
|
6
|
+
|
|
7
|
+
## Configuration
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
Markdown/StrongStyle:
|
|
11
|
+
Enabled: true
|
|
12
|
+
Style: consistent # consistent, asterisk or underscore.
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Example
|
|
16
|
+
|
|
17
|
+
For this configuration:
|
|
18
|
+
|
|
19
|
+
```yaml
|
|
20
|
+
Markdown/StrongStyle:
|
|
21
|
+
Style: underscore
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Bad
|
|
25
|
+
|
|
26
|
+
```markdown
|
|
27
|
+
This is **important**.
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Good
|
|
31
|
+
|
|
32
|
+
```markdown
|
|
33
|
+
This is __important__.
|
|
34
|
+
```
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Markdown/StructuralLineLength
|
|
2
|
+
|
|
3
|
+
Reports long heading, code-block, and table source lines without rewriting structural content.
|
|
4
|
+
|
|
5
|
+
Use [Prose/MaxLength](../prose/max_length.md) for paragraph formatting. Structural limits and paragraph formatting are configured independently.
|
|
6
|
+
|
|
7
|
+
## Configuration
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
Markdown/StructuralLineLength:
|
|
11
|
+
Enabled: false
|
|
12
|
+
Max: 80 # Positive character count.
|
|
13
|
+
Headings: true
|
|
14
|
+
HeadingMax: null # Inherit Max.
|
|
15
|
+
CodeBlocks: false
|
|
16
|
+
CodeBlockMax: null # Inherit Max.
|
|
17
|
+
Tables: false # Includes delimiter rows when enabled.
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Example
|
|
21
|
+
|
|
22
|
+
For this configuration:
|
|
23
|
+
|
|
24
|
+
```yaml
|
|
25
|
+
Markdown/StructuralLineLength:
|
|
26
|
+
Enabled: true
|
|
27
|
+
Max: 12
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Bad
|
|
31
|
+
|
|
32
|
+
```markdown
|
|
33
|
+
# A very long heading
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Good
|
|
37
|
+
|
|
38
|
+
```markdown
|
|
39
|
+
# Short
|
|
40
|
+
```
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Markdown/Syntax
|
|
2
|
+
|
|
3
|
+
Reports Kramdown GFM parsing warnings through RuboCop. Report-only.
|
|
4
|
+
|
|
5
|
+
Reference warnings are handled by [Markdown/UndefinedReference](undefined_reference.md) and [Markdown/ReferenceDefinitions](reference_definitions.md) when enabled, avoiding duplicate reports.
|
|
6
|
+
|
|
7
|
+
## Configuration
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
Markdown/Syntax:
|
|
11
|
+
Enabled: true
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Example
|
|
15
|
+
|
|
16
|
+
### Bad
|
|
17
|
+
|
|
18
|
+
```markdown
|
|
19
|
+
[Read the guide][missing]
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Good
|
|
23
|
+
|
|
24
|
+
```markdown
|
|
25
|
+
[Read the guide][docs]
|
|
26
|
+
|
|
27
|
+
[docs]: /guide
|
|
28
|
+
```
|