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.
Files changed (228) hide show
  1. checksums.yaml +7 -0
  2. data/AGENTS.md +13 -0
  3. data/CHANGELOG.md +82 -0
  4. data/CONTRIBUTING.md +77 -0
  5. data/DESIGN.md +51 -0
  6. data/LICENSE.txt +21 -0
  7. data/README.md +152 -0
  8. data/RELEASING.md +32 -0
  9. data/assets/README.md +3 -0
  10. data/assets/RUBOCOP-LICENSE +20 -0
  11. data/assets/logo.gif +0 -0
  12. data/assets/logo.png +0 -0
  13. data/assets/logo.svg +80 -0
  14. data/assets/rubocop-logo.svg +1 -0
  15. data/config/cops/markdown/atx_heading_space.yml +3 -0
  16. data/config/cops/markdown/atx_heading_spacing.yml +3 -0
  17. data/config/cops/markdown/bare_url.yml +7 -0
  18. data/config/cops/markdown/blockquote_blank_lines.yml +3 -0
  19. data/config/cops/markdown/blockquote_spacing.yml +3 -0
  20. data/config/cops/markdown/closed_heading_space.yml +3 -0
  21. data/config/cops/markdown/closed_heading_spacing.yml +3 -0
  22. data/config/cops/markdown/code_block_style.yml +8 -0
  23. data/config/cops/markdown/code_span_spacing.yml +3 -0
  24. data/config/cops/markdown/compact_lists.yml +3 -0
  25. data/config/cops/markdown/descriptive_link_text.yml +8 -0
  26. data/config/cops/markdown/duplicate_headings.yml +4 -0
  27. data/config/cops/markdown/emphasis_heading.yml +3 -0
  28. data/config/cops/markdown/emphasis_spacing.yml +3 -0
  29. data/config/cops/markdown/emphasis_style.yml +4 -0
  30. data/config/cops/markdown/empty_link.yml +3 -0
  31. data/config/cops/markdown/fence_blank_lines.yml +6 -0
  32. data/config/cops/markdown/fence_language.yml +4 -0
  33. data/config/cops/markdown/fence_style.yml +8 -0
  34. data/config/cops/markdown/first_heading.yml +6 -0
  35. data/config/cops/markdown/front_matter.yml +2 -0
  36. data/config/cops/markdown/hard_break_style.yml +4 -0
  37. data/config/cops/markdown/hard_tabs.yml +5 -0
  38. data/config/cops/markdown/heading_blank_lines.yml +5 -0
  39. data/config/cops/markdown/heading_increment.yml +3 -0
  40. data/config/cops/markdown/heading_indentation.yml +3 -0
  41. data/config/cops/markdown/heading_punctuation.yml +4 -0
  42. data/config/cops/markdown/heading_structure.yml +4 -0
  43. data/config/cops/markdown/heading_style.yml +9 -0
  44. data/config/cops/markdown/image_alt_text.yml +3 -0
  45. data/config/cops/markdown/image_path_separators.yml +3 -0
  46. data/config/cops/markdown/link_fragment.yml +6 -0
  47. data/config/cops/markdown/link_style.yml +10 -0
  48. data/config/cops/markdown/link_text_spacing.yml +3 -0
  49. data/config/cops/markdown/list_blank_lines.yml +3 -0
  50. data/config/cops/markdown/list_continuation_indentation.yml +3 -0
  51. data/config/cops/markdown/list_indentation.yml +3 -0
  52. data/config/cops/markdown/list_marker_spacing.yml +7 -0
  53. data/config/cops/markdown/ordered_list_numbering.yml +7 -0
  54. data/config/cops/markdown/outside_spacing.yml +3 -0
  55. data/config/cops/markdown/proper_names.yml +5 -0
  56. data/config/cops/markdown/raw_html.yml +4 -0
  57. data/config/cops/markdown/reference_definitions.yml +8 -0
  58. data/config/cops/markdown/reversed_link.yml +3 -0
  59. data/config/cops/markdown/shell_prompts.yml +13 -0
  60. data/config/cops/markdown/single_top_level_heading.yml +4 -0
  61. data/config/cops/markdown/strong_style.yml +4 -0
  62. data/config/cops/markdown/structural_line_length.yml +9 -0
  63. data/config/cops/markdown/syntax.yml +3 -0
  64. data/config/cops/markdown/table_blank_lines.yml +3 -0
  65. data/config/cops/markdown/table_columns.yml +3 -0
  66. data/config/cops/markdown/table_pipes.yml +4 -0
  67. data/config/cops/markdown/table_spacing.yml +4 -0
  68. data/config/cops/markdown/thematic_break_blank_lines.yml +5 -0
  69. data/config/cops/markdown/thematic_break_style.yml +4 -0
  70. data/config/cops/markdown/trailing_whitespace.yml +5 -0
  71. data/config/cops/markdown/unclosed_fenced_code_block.yml +3 -0
  72. data/config/cops/markdown/undefined_reference.yml +4 -0
  73. data/config/cops/markdown/unordered_list_indentation.yml +4 -0
  74. data/config/cops/markdown/unordered_list_marker.yml +9 -0
  75. data/config/cops/prose/max_length.yml +5 -0
  76. data/config/cops/prose/multiple_blank_lines.yml +4 -0
  77. data/config/cops/prose/trailing_newline.yml +3 -0
  78. data/config/cops/text/trailing_whitespace.yml +3 -0
  79. data/config/default.yml +16 -0
  80. data/docs/cops/markdown/atx_heading_space.md +26 -0
  81. data/docs/cops/markdown/atx_heading_spacing.md +24 -0
  82. data/docs/cops/markdown/bare_url.md +30 -0
  83. data/docs/cops/markdown/blockquote_blank_lines.md +30 -0
  84. data/docs/cops/markdown/blockquote_spacing.md +30 -0
  85. data/docs/cops/markdown/closed_heading_space.md +26 -0
  86. data/docs/cops/markdown/closed_heading_spacing.md +24 -0
  87. data/docs/cops/markdown/code_block_style.md +37 -0
  88. data/docs/cops/markdown/code_span_spacing.md +26 -0
  89. data/docs/cops/markdown/compact_lists.md +29 -0
  90. data/docs/cops/markdown/descriptive_link_text.md +31 -0
  91. data/docs/cops/markdown/duplicate_headings.md +35 -0
  92. data/docs/cops/markdown/emphasis_heading.md +26 -0
  93. data/docs/cops/markdown/emphasis_spacing.md +24 -0
  94. data/docs/cops/markdown/emphasis_style.md +34 -0
  95. data/docs/cops/markdown/empty_link.md +26 -0
  96. data/docs/cops/markdown/fence_blank_lines.md +43 -0
  97. data/docs/cops/markdown/fence_language.md +31 -0
  98. data/docs/cops/markdown/fence_style.md +38 -0
  99. data/docs/cops/markdown/first_heading.md +31 -0
  100. data/docs/cops/markdown/hard_break_style.md +50 -0
  101. data/docs/cops/markdown/hard_tabs.md +30 -0
  102. data/docs/cops/markdown/heading_blank_lines.md +36 -0
  103. data/docs/cops/markdown/heading_increment.md +30 -0
  104. data/docs/cops/markdown/heading_indentation.md +26 -0
  105. data/docs/cops/markdown/heading_punctuation.md +27 -0
  106. data/docs/cops/markdown/heading_structure.md +41 -0
  107. data/docs/cops/markdown/heading_style.md +36 -0
  108. data/docs/cops/markdown/image_alt_text.md +26 -0
  109. data/docs/cops/markdown/image_path_separators.md +32 -0
  110. data/docs/cops/markdown/link_fragment.md +35 -0
  111. data/docs/cops/markdown/link_style.md +49 -0
  112. data/docs/cops/markdown/link_text_spacing.md +26 -0
  113. data/docs/cops/markdown/list_blank_lines.md +31 -0
  114. data/docs/cops/markdown/list_continuation_indentation.md +28 -0
  115. data/docs/cops/markdown/list_indentation.md +28 -0
  116. data/docs/cops/markdown/list_marker_spacing.md +32 -0
  117. data/docs/cops/markdown/ordered_list_numbering.md +29 -0
  118. data/docs/cops/markdown/outside_spacing.md +26 -0
  119. data/docs/cops/markdown/proper_names.md +39 -0
  120. data/docs/cops/markdown/raw_html.md +27 -0
  121. data/docs/cops/markdown/reference_definitions.md +36 -0
  122. data/docs/cops/markdown/reversed_link.md +26 -0
  123. data/docs/cops/markdown/shell_prompts.md +57 -0
  124. data/docs/cops/markdown/single_top_level_heading.md +31 -0
  125. data/docs/cops/markdown/strong_style.md +34 -0
  126. data/docs/cops/markdown/structural_line_length.md +40 -0
  127. data/docs/cops/markdown/syntax.md +28 -0
  128. data/docs/cops/markdown/table_blank_lines.md +34 -0
  129. data/docs/cops/markdown/table_columns.md +30 -0
  130. data/docs/cops/markdown/table_pipes.md +38 -0
  131. data/docs/cops/markdown/table_spacing.md +38 -0
  132. data/docs/cops/markdown/thematic_break_blank_lines.md +31 -0
  133. data/docs/cops/markdown/thematic_break_style.md +48 -0
  134. data/docs/cops/markdown/trailing_whitespace.md +30 -0
  135. data/docs/cops/markdown/unclosed_fenced_code_block.md +29 -0
  136. data/docs/cops/markdown/undefined_reference.md +29 -0
  137. data/docs/cops/markdown/unordered_list_indentation.md +45 -0
  138. data/docs/cops/markdown/unordered_list_marker.md +36 -0
  139. data/docs/cops/prose/max_length.md +33 -0
  140. data/docs/cops/prose/multiple_blank_lines.md +50 -0
  141. data/docs/cops/prose/trailing_newline.md +26 -0
  142. data/docs/cops/text/trailing_whitespace.md +26 -0
  143. data/docs/settings/files.md +33 -0
  144. data/docs/settings/front_matter.md +12 -0
  145. data/lib/rubocop/cop/markdown/atx_heading_space.rb +22 -0
  146. data/lib/rubocop/cop/markdown/atx_heading_spacing.rb +27 -0
  147. data/lib/rubocop/cop/markdown/bare_url.rb +22 -0
  148. data/lib/rubocop/cop/markdown/base.rb +17 -0
  149. data/lib/rubocop/cop/markdown/blockquote_blank_lines.rb +49 -0
  150. data/lib/rubocop/cop/markdown/blockquote_spacing.rb +76 -0
  151. data/lib/rubocop/cop/markdown/closed_heading_space.rb +26 -0
  152. data/lib/rubocop/cop/markdown/closed_heading_spacing.rb +27 -0
  153. data/lib/rubocop/cop/markdown/code_block_style.rb +80 -0
  154. data/lib/rubocop/cop/markdown/code_span_spacing.rb +51 -0
  155. data/lib/rubocop/cop/markdown/compact_lists.rb +43 -0
  156. data/lib/rubocop/cop/markdown/descriptive_link_text.rb +27 -0
  157. data/lib/rubocop/cop/markdown/duplicate_headings.rb +28 -0
  158. data/lib/rubocop/cop/markdown/emphasis_heading.rb +18 -0
  159. data/lib/rubocop/cop/markdown/emphasis_spacing.rb +30 -0
  160. data/lib/rubocop/cop/markdown/emphasis_style.rb +34 -0
  161. data/lib/rubocop/cop/markdown/empty_link.rb +25 -0
  162. data/lib/rubocop/cop/markdown/fence_blank_lines.rb +72 -0
  163. data/lib/rubocop/cop/markdown/fence_language.rb +32 -0
  164. data/lib/rubocop/cop/markdown/fence_style.rb +39 -0
  165. data/lib/rubocop/cop/markdown/first_heading.rb +44 -0
  166. data/lib/rubocop/cop/markdown/hard_break_style.rb +65 -0
  167. data/lib/rubocop/cop/markdown/hard_tabs.rb +32 -0
  168. data/lib/rubocop/cop/markdown/heading_blank_lines.rb +37 -0
  169. data/lib/rubocop/cop/markdown/heading_increment.rb +23 -0
  170. data/lib/rubocop/cop/markdown/heading_indentation.rb +37 -0
  171. data/lib/rubocop/cop/markdown/heading_punctuation.rb +23 -0
  172. data/lib/rubocop/cop/markdown/heading_structure.rb +33 -0
  173. data/lib/rubocop/cop/markdown/heading_style.rb +24 -0
  174. data/lib/rubocop/cop/markdown/image_alt_text.rb +24 -0
  175. data/lib/rubocop/cop/markdown/image_path_separators.rb +32 -0
  176. data/lib/rubocop/cop/markdown/link_fragment.rb +36 -0
  177. data/lib/rubocop/cop/markdown/link_style.rb +29 -0
  178. data/lib/rubocop/cop/markdown/link_text_spacing.rb +34 -0
  179. data/lib/rubocop/cop/markdown/list_blank_lines.rb +38 -0
  180. data/lib/rubocop/cop/markdown/list_continuation_indentation.rb +59 -0
  181. data/lib/rubocop/cop/markdown/list_indentation.rb +28 -0
  182. data/lib/rubocop/cop/markdown/list_marker_spacing.rb +44 -0
  183. data/lib/rubocop/cop/markdown/ordered_list_numbering.rb +35 -0
  184. data/lib/rubocop/cop/markdown/outside_spacing.rb +88 -0
  185. data/lib/rubocop/cop/markdown/proper_names.rb +51 -0
  186. data/lib/rubocop/cop/markdown/raw_html.rb +60 -0
  187. data/lib/rubocop/cop/markdown/reference_definitions.rb +37 -0
  188. data/lib/rubocop/cop/markdown/reversed_link.rb +20 -0
  189. data/lib/rubocop/cop/markdown/shell_prompts.rb +72 -0
  190. data/lib/rubocop/cop/markdown/single_top_level_heading.rb +19 -0
  191. data/lib/rubocop/cop/markdown/strong_style.rb +33 -0
  192. data/lib/rubocop/cop/markdown/structural_line_length.rb +51 -0
  193. data/lib/rubocop/cop/markdown/syntax.rb +33 -0
  194. data/lib/rubocop/cop/markdown/table_blank_lines.rb +46 -0
  195. data/lib/rubocop/cop/markdown/table_columns.rb +23 -0
  196. data/lib/rubocop/cop/markdown/table_pipes.rb +45 -0
  197. data/lib/rubocop/cop/markdown/table_spacing.rb +62 -0
  198. data/lib/rubocop/cop/markdown/thematic_break_blank_lines.rb +115 -0
  199. data/lib/rubocop/cop/markdown/thematic_break_style.rb +74 -0
  200. data/lib/rubocop/cop/markdown/trailing_whitespace.rb +55 -0
  201. data/lib/rubocop/cop/markdown/unclosed_fenced_code_block.rb +82 -0
  202. data/lib/rubocop/cop/markdown/undefined_reference.rb +25 -0
  203. data/lib/rubocop/cop/markdown/unordered_list_indentation.rb +37 -0
  204. data/lib/rubocop/cop/markdown/unordered_list_marker.rb +45 -0
  205. data/lib/rubocop/cop/prose/base.rb +55 -0
  206. data/lib/rubocop/cop/prose/max_length.rb +93 -0
  207. data/lib/rubocop/cop/prose/multiple_blank_lines.rb +96 -0
  208. data/lib/rubocop/cop/prose/trailing_newline.rb +26 -0
  209. data/lib/rubocop/cop/text/base.rb +17 -0
  210. data/lib/rubocop/cop/text/trailing_whitespace.rb +25 -0
  211. data/lib/rubocop/prose/code_rules.rb +79 -0
  212. data/lib/rubocop/prose/document.rb +62 -0
  213. data/lib/rubocop/prose/file_types.rb +56 -0
  214. data/lib/rubocop/prose/heading_rules.rb +54 -0
  215. data/lib/rubocop/prose/inline_rules.rb +213 -0
  216. data/lib/rubocop/prose/link_rules.rb +630 -0
  217. data/lib/rubocop/prose/list_rules.rb +65 -0
  218. data/lib/rubocop/prose/markdown_document.rb +167 -0
  219. data/lib/rubocop/prose/parser.rb +80 -0
  220. data/lib/rubocop/prose/plugin.rb +30 -0
  221. data/lib/rubocop/prose/runner.rb +63 -0
  222. data/lib/rubocop/prose/source.rb +82 -0
  223. data/lib/rubocop/prose/structural_blank_lines.rb +90 -0
  224. data/lib/rubocop/prose/table_rules.rb +71 -0
  225. data/lib/rubocop/prose/text_document.rb +54 -0
  226. data/lib/rubocop/prose/version.rb +7 -0
  227. data/lib/rubocop-prose.rb +30 -0
  228. metadata +335 -0
@@ -0,0 +1,37 @@
1
+ # Markdown/CodeBlockStyle
2
+
3
+ Enforces fenced, indented, or consistent code blocks, including nested blocks. Consistent mode follows the first block.
4
+
5
+ Autocorrection is limited to standalone root-level blocks with blank boundaries. Blocks with metadata, nested containers, empty fenced bodies, or leading/trailing blank content are report-only. Adjacent code blocks are not converted to indentation, to avoid merging them.
6
+
7
+ ## Configuration
8
+
9
+ ```yaml
10
+ Markdown/CodeBlockStyle:
11
+ Enabled: false
12
+ EnforcedStyle: consistent # consistent, fenced or indented.
13
+ ```
14
+
15
+ ## Example
16
+
17
+ For this configuration:
18
+
19
+ ```yaml
20
+ Markdown/CodeBlockStyle:
21
+ Enabled: true
22
+ EnforcedStyle: fenced
23
+ ```
24
+
25
+ ### Bad
26
+
27
+ ```markdown
28
+ puts 'hello'
29
+ ```
30
+
31
+ ### Good
32
+
33
+ ````markdown
34
+ ```ruby
35
+ puts 'hello'
36
+ ```
37
+ ````
@@ -0,0 +1,26 @@
1
+ # Markdown/CodeSpanSpacing
2
+
3
+ Reports unnecessary padding inside inline code. All-space values and padding needed around literal backticks are accepted.
4
+
5
+ Autocorrection removes a single redundant space from each edge of a single-line span: `` ` foo ` `` becomes `` `foo` ``. Other padding is report-only because removing it can change the code value.
6
+
7
+ ## Configuration
8
+
9
+ ```yaml
10
+ Markdown/CodeSpanSpacing:
11
+ Enabled: true
12
+ ```
13
+
14
+ ## Example
15
+
16
+ ### Bad
17
+
18
+ ```markdown
19
+ Use ` code ` here.
20
+ ```
21
+
22
+ ### Good
23
+
24
+ ```markdown
25
+ Use `code` here.
26
+ ```
@@ -0,0 +1,29 @@
1
+ # Markdown/CompactLists
2
+
3
+ Reports blank lines between sibling list items. Blank lines inside an item are not affected. Corrections remove the separator only when both adjacent items consist of a single paragraph; separators next to complex items are reported without correction.
4
+
5
+ ## Configuration
6
+
7
+ ```yaml
8
+ Markdown/CompactLists:
9
+ Enabled: true
10
+ ```
11
+
12
+ ## Example
13
+
14
+ ### Bad
15
+
16
+ ```markdown
17
+ - First item.
18
+
19
+ - Second item.
20
+ ```
21
+
22
+ ### Good
23
+
24
+ ```markdown
25
+ - First item.
26
+ - Second item.
27
+ ```
28
+
29
+ Blank lines separating paragraphs, nested lists, or code within an item remain in place.
@@ -0,0 +1,31 @@
1
+ # Markdown/DescriptiveLinkText
2
+
3
+ Reports links whose entire rendered label matches a configured generic label, ignoring case and repeated whitespace. Prefer descriptive text such as `[the installation guide](https://example.test)`.
4
+
5
+ Matching is whole-label: `click here for installation` does not match `click here`. Images and autolinks are not checked. Report-only.
6
+
7
+ ## Configuration
8
+
9
+ ```yaml
10
+ Markdown/DescriptiveLinkText:
11
+ Enabled: true
12
+ GenericLabels: # Customize for the project's language; an empty list permits every label.
13
+ - click here
14
+ - here
15
+ - link
16
+ - more
17
+ ```
18
+
19
+ ## Example
20
+
21
+ ### Bad
22
+
23
+ ```markdown
24
+ [click here](/guide)
25
+ ```
26
+
27
+ ### Good
28
+
29
+ ```markdown
30
+ [Read the installation guide](/guide)
31
+ ```
@@ -0,0 +1,35 @@
1
+ # Markdown/DuplicateHeadings
2
+
3
+ Reports duplicate heading text within the configured scope. Comparison is case-sensitive text without whitespace normalization, including inline code but ignoring emphasis.
4
+
5
+ Sibling headings share a parent heading; root headings share a scope. Each new parent starts a fresh scope, even when its text repeats. Report-only: renaming headings can break links.
6
+
7
+ ## Configuration
8
+
9
+ ```yaml
10
+ Markdown/DuplicateHeadings:
11
+ Enabled: true
12
+ Scope: siblings # Or document to compare headings across the entire document.
13
+ ```
14
+
15
+ ## Example
16
+
17
+ ### Bad
18
+
19
+ ```markdown
20
+ # Guide
21
+
22
+ ## Usage
23
+
24
+ ## Usage
25
+ ```
26
+
27
+ ### Good
28
+
29
+ ```markdown
30
+ # Guide
31
+
32
+ ## Usage
33
+
34
+ ## License
35
+ ```
@@ -0,0 +1,26 @@
1
+ # Markdown/EmphasisHeading
2
+
3
+ Reports single-line paragraphs consisting entirely of italic or bold text, such as `**Overview**`, including in lists and blockquotes.
4
+
5
+ Report-only: the paragraph may be intentional; otherwise, choose an appropriate heading level.
6
+
7
+ ## Configuration
8
+
9
+ ```yaml
10
+ Markdown/EmphasisHeading:
11
+ Enabled: false
12
+ ```
13
+
14
+ ## Example
15
+
16
+ ### Bad
17
+
18
+ ```markdown
19
+ *Installation*
20
+ ```
21
+
22
+ ### Good
23
+
24
+ ```markdown
25
+ ## Installation
26
+ ```
@@ -0,0 +1,24 @@
1
+ # Markdown/EmphasisSpacing
2
+
3
+ Removes whitespace just inside matching emphasis delimiters on a single line, preserving the content and delimiter style. For example, `** two words **` becomes `**two words**`.
4
+
5
+ ## Configuration
6
+
7
+ ```yaml
8
+ Markdown/EmphasisSpacing:
9
+ Enabled: true
10
+ ```
11
+
12
+ ## Example
13
+
14
+ ### Bad
15
+
16
+ ```markdown
17
+ Some * padded * text.
18
+ ```
19
+
20
+ ### Good
21
+
22
+ ```markdown
23
+ Some *padded* text.
24
+ ```
@@ -0,0 +1,34 @@
1
+ # Markdown/EmphasisStyle
2
+
3
+ Enforces a configured emphasis delimiter or follows the first one in consistent mode. Strong emphasis belongs to [Markdown/StrongStyle](strong_style.md).
4
+
5
+ Autocorrection preserves content. Intraword asterisks are not changed to underscores when that would remove the emphasis.
6
+
7
+ ## Configuration
8
+
9
+ ```yaml
10
+ Markdown/EmphasisStyle:
11
+ Enabled: true
12
+ Style: consistent # consistent, asterisk or underscore.
13
+ ```
14
+
15
+ ## Example
16
+
17
+ For this configuration:
18
+
19
+ ```yaml
20
+ Markdown/EmphasisStyle:
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,26 @@
1
+ # Markdown/EmptyLink
2
+
3
+ Reports links with an empty destination or just `#`, including reference links. Empty labels with real destinations and images are not checked.
4
+
5
+ Report-only: supply the intended destination.
6
+
7
+ ## Configuration
8
+
9
+ ```yaml
10
+ Markdown/EmptyLink:
11
+ Enabled: true
12
+ ```
13
+
14
+ ## Example
15
+
16
+ ### Bad
17
+
18
+ ```markdown
19
+ [Read the guide]()
20
+ ```
21
+
22
+ ### Good
23
+
24
+ ```markdown
25
+ [Read the guide](/guide)
26
+ ```
@@ -0,0 +1,43 @@
1
+ # Markdown/FenceBlankLines
2
+
3
+ Requires the configured minimum blank lines above and below fenced code blocks, preserving list and blockquote nesting. Set either count to zero to leave that boundary unchecked. Document boundaries and a preceding front-matter header do not require extra padding.
4
+
5
+ A fence on a list marker's own line does not require a blank before it.
6
+
7
+ Both counts must be nonnegative integers; `null` is invalid.
8
+
9
+ [Prose/MultipleBlankLines](../prose/multiple_blank_lines.md) preserves these minimums at fence boundaries without relaxing its limit elsewhere.
10
+
11
+ ## Configuration
12
+
13
+ ```yaml
14
+ Markdown/FenceBlankLines:
15
+ Enabled: true
16
+ LinesAbove: 1 # Nonnegative minimum; zero disables checks above fences.
17
+ LinesBelow: 1 # Nonnegative minimum; zero disables checks below fences.
18
+ ListItems: true # Set false to skip fences inside list items.
19
+ ```
20
+
21
+ ## Example
22
+
23
+ ### Bad
24
+
25
+ ````markdown
26
+ Example:
27
+ ```ruby
28
+ puts 1
29
+ ```
30
+ More text.
31
+ ````
32
+
33
+ ### Good
34
+
35
+ ````markdown
36
+ Example:
37
+
38
+ ```ruby
39
+ puts 1
40
+ ```
41
+
42
+ More text.
43
+ ````
@@ -0,0 +1,31 @@
1
+ # Markdown/FenceLanguage
2
+
3
+ Requires a language on fenced code blocks, optionally restricted to an allowlist. Names are case-sensitive.
4
+
5
+ Report-only: specify the appropriate language.
6
+
7
+ ## Configuration
8
+
9
+ ```yaml
10
+ Markdown/FenceLanguage:
11
+ Enabled: true
12
+ AllowedLanguages: [] # Accept any nonempty language; otherwise allow only listed, case-sensitive names.
13
+ ```
14
+
15
+ ## Example
16
+
17
+ ### Bad
18
+
19
+ ````markdown
20
+ ```
21
+ puts 1
22
+ ```
23
+ ````
24
+
25
+ ### Good
26
+
27
+ ````markdown
28
+ ```ruby
29
+ puts 1
30
+ ```
31
+ ````
@@ -0,0 +1,38 @@
1
+ # Markdown/FenceStyle
2
+
3
+ Enforces backtick, tilde, or consistent code fences. Consistent mode follows the first fence.
4
+
5
+ Autocorrection preserves contents, language metadata, and nesting. Conversion to backticks is report-only if the information string contains backticks.
6
+
7
+ ## Configuration
8
+
9
+ ```yaml
10
+ Markdown/FenceStyle:
11
+ Enabled: true
12
+ EnforcedStyle: consistent # consistent, backtick or tilde.
13
+ ```
14
+
15
+ ## Example
16
+
17
+ For this configuration:
18
+
19
+ ```yaml
20
+ Markdown/FenceStyle:
21
+ EnforcedStyle: backtick
22
+ ```
23
+
24
+ ### Bad
25
+
26
+ ```markdown
27
+ ~~~ruby
28
+ puts 1
29
+ ~~~
30
+ ```
31
+
32
+ ### Good
33
+
34
+ ````markdown
35
+ ```ruby
36
+ puts 1
37
+ ```
38
+ ````
@@ -0,0 +1,31 @@
1
+ # Markdown/FirstHeading
2
+
3
+ Requires the first content line to be a heading at the configured level, unless a configured front-matter title qualifies. Empty documents are accepted.
4
+
5
+ Front-matter titles must be strings; YAML aliases are not accepted. Report-only: adding or moving a heading changes structure.
6
+
7
+ ## Configuration
8
+
9
+ ```yaml
10
+ Markdown/FirstHeading:
11
+ Enabled: false
12
+ Level: 1
13
+ FrontMatterTitle: true # Accept a nonempty front-matter title instead of a heading.
14
+ TitleKey: title # Exact top-level YAML key, not a regular expression.
15
+ ```
16
+
17
+ ## Example
18
+
19
+ ### Bad
20
+
21
+ ```markdown
22
+ An introduction to the project.
23
+ ```
24
+
25
+ ### Good
26
+
27
+ ```markdown
28
+ # Introduction
29
+
30
+ An introduction to the project.
31
+ ```
@@ -0,0 +1,50 @@
1
+ # Markdown/HardBreakStyle
2
+
3
+ Requires Markdown paragraph hard breaks to use the configured backslash or trailing-space syntax. The default backslash style is enabled automatically.
4
+
5
+ On files whose line endings cannot be preserved by RuboCop's source buffer, this cop reports style violations without autocorrecting them.
6
+
7
+ ## Configuration
8
+
9
+ ```yaml
10
+ Markdown/HardBreakStyle:
11
+ Enabled: true
12
+ Style: backslash # backslash or spaces.
13
+ ```
14
+
15
+ ## Example
16
+
17
+ ### Bad: trailing spaces
18
+
19
+ ```markdown
20
+ First line.
21
+ Second line.
22
+ ```
23
+
24
+ ### Good: backslash
25
+
26
+ ```markdown
27
+ First line.\
28
+ Second line.
29
+ ```
30
+
31
+ For this configuration:
32
+
33
+ ```yaml
34
+ Markdown/HardBreakStyle:
35
+ Style: spaces
36
+ ```
37
+
38
+ ### Bad: backslash
39
+
40
+ ```markdown
41
+ First line.\
42
+ Second line.
43
+ ```
44
+
45
+ ### Good: trailing spaces
46
+
47
+ ```markdown
48
+ First line.
49
+ Second line.
50
+ ```
@@ -0,0 +1,30 @@
1
+ # Markdown/HardTabs
2
+
3
+ Reports hard tabs, with configurable code-language exceptions.
4
+
5
+ Report-only: replacing tabs can change embedded code or Makefiles.
6
+
7
+ ## Configuration
8
+
9
+ ```yaml
10
+ Markdown/HardTabs:
11
+ Enabled: true
12
+ CodeBlocks: false # Preserve tabs in code examples; set true to inspect code.
13
+ AllowedCodeLanguages: [] # Case-insensitive fenced languages to exempt, such as make.
14
+ ```
15
+
16
+ ## Example
17
+
18
+ Inputs are shown as Ruby strings so tabs, trailing spaces, and newline characters are visible.
19
+
20
+ ### Bad
21
+
22
+ ```ruby
23
+ "A\tparagraph.\n"
24
+ ```
25
+
26
+ ### Good
27
+
28
+ ```ruby
29
+ "A paragraph.\n"
30
+ ```
@@ -0,0 +1,36 @@
1
+ # Markdown/HeadingBlankLines
2
+
3
+ Requires the configured blank lines around headings, measuring below the underline for Setext headings. Document boundaries and the end of front matter do not require padding; empty blockquote lines count as blank.
4
+
5
+ Report-only: inserting blank lines can change surrounding lists and blockquotes.
6
+
7
+ [Prose/MultipleBlankLines](../prose/multiple_blank_lines.md) preserves these minimums at heading boundaries without relaxing its limit elsewhere.
8
+
9
+ ## Configuration
10
+
11
+ ```yaml
12
+ Markdown/HeadingBlankLines:
13
+ Enabled: true
14
+ LinesAbove: 1 # Minimum blank lines before a heading; 0 disables this requirement.
15
+ LinesBelow: 1 # Minimum blank lines after a heading; 0 disables this requirement.
16
+ ```
17
+
18
+ ## Example
19
+
20
+ ### Bad
21
+
22
+ ```markdown
23
+ Introduction.
24
+ ## Usage
25
+ Follow these steps.
26
+ ```
27
+
28
+ ### Good
29
+
30
+ ```markdown
31
+ Introduction.
32
+
33
+ ## Usage
34
+
35
+ Follow these steps.
36
+ ```
@@ -0,0 +1,30 @@
1
+ # Markdown/HeadingIncrement
2
+
3
+ Reports skipped heading levels, such as `# Title` followed by `### Detail`. The first heading can have any level, and decreases are unrestricted.
4
+
5
+ Report-only: choose the appropriate heading level.
6
+
7
+ ## Configuration
8
+
9
+ ```yaml
10
+ Markdown/HeadingIncrement:
11
+ Enabled: true
12
+ ```
13
+
14
+ ## Example
15
+
16
+ ### Bad
17
+
18
+ ```markdown
19
+ # Guide
20
+
21
+ ### Usage
22
+ ```
23
+
24
+ ### Good
25
+
26
+ ```markdown
27
+ # Guide
28
+
29
+ ## Usage
30
+ ```
@@ -0,0 +1,26 @@
1
+ # Markdown/HeadingIndentation
2
+
3
+ Reports indentation before headings or their outermost container marker; `> # Title` is accepted only without leading spaces. For Setext headings, only the text line's indentation is checked.
4
+
5
+ Report-only: removing indentation can change the surrounding structure.
6
+
7
+ ## Configuration
8
+
9
+ ```yaml
10
+ Markdown/HeadingIndentation:
11
+ Enabled: true
12
+ ```
13
+
14
+ ## Example
15
+
16
+ ### Bad
17
+
18
+ ```markdown
19
+ # Title
20
+ ```
21
+
22
+ ### Good
23
+
24
+ ```markdown
25
+ # Title
26
+ ```
@@ -0,0 +1,27 @@
1
+ # Markdown/HeadingPunctuation
2
+
3
+ Reports configured punctuation at the end of rendered heading text, including inline code. Closing heading hashes do not count as punctuation.
4
+
5
+ Report-only: punctuation may be meaningful.
6
+
7
+ ## Configuration
8
+
9
+ ```yaml
10
+ Markdown/HeadingPunctuation:
11
+ Enabled: false
12
+ Punctuation: ".,;:!?" # Forbidden final characters; accepts Unicode. Use '' to disable.
13
+ ```
14
+
15
+ ## Example
16
+
17
+ ### Bad
18
+
19
+ ```markdown
20
+ # Installation!
21
+ ```
22
+
23
+ ### Good
24
+
25
+ ```markdown
26
+ # Installation
27
+ ```
@@ -0,0 +1,41 @@
1
+ # Markdown/HeadingStructure
2
+
3
+ Requires an exact heading outline, in order. Write each entry as one to six hashes, a space, and the expected heading text; ATX and Setext headings are equivalent when their level and text match.
4
+
5
+ Missing, extra, and mismatched headings are reported without correction.
6
+
7
+ ## Configuration
8
+
9
+ ```yaml
10
+ Markdown/HeadingStructure:
11
+ Enabled: false
12
+ Headings: [] # Exact ordered outline; an empty list disables checks.
13
+ ```
14
+
15
+ ## Example
16
+
17
+ For this configuration:
18
+
19
+ ```yaml
20
+ Markdown/HeadingStructure:
21
+ Enabled: true
22
+ Headings:
23
+ - "# Guide"
24
+ - "## Usage"
25
+ ```
26
+
27
+ ### Bad
28
+
29
+ ```markdown
30
+ # Guide
31
+
32
+ ## Installation
33
+ ```
34
+
35
+ ### Good
36
+
37
+ ```markdown
38
+ # Guide
39
+
40
+ ## Usage
41
+ ```
@@ -0,0 +1,36 @@
1
+ # Markdown/HeadingStyle
2
+
3
+ Enforces ATX, closed ATX, Setext, or consistent headings. Consistent mode follows the first heading. Setext supports only levels one and two.
4
+
5
+ Report-only: changing syntax can alter heading levels or surrounding structure.
6
+
7
+ ## Configuration
8
+
9
+ ```yaml
10
+ Markdown/HeadingStyle:
11
+ Enabled: false
12
+ EnforcedStyle: consistent # consistent, atx, atx_closed or setext.
13
+ ```
14
+
15
+ ## Example
16
+
17
+ For this configuration:
18
+
19
+ ```yaml
20
+ Markdown/HeadingStyle:
21
+ Enabled: true
22
+ EnforcedStyle: atx
23
+ ```
24
+
25
+ ### Bad
26
+
27
+ ```markdown
28
+ Title
29
+ =====
30
+ ```
31
+
32
+ ### Good
33
+
34
+ ```markdown
35
+ # Title
36
+ ```