codelaw-rules-data 0.2.0__py3-none-any.whl

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 (84) hide show
  1. codelaw_rules_data/LICENSE +23 -0
  2. codelaw_rules_data/NOTICE +31 -0
  3. codelaw_rules_data/README.md +130 -0
  4. codelaw_rules_data/codelaw-pack.toml +6 -0
  5. codelaw_rules_data/corpus.toml +41 -0
  6. codelaw_rules_data/data/schemas/github-action.json +1 -0
  7. codelaw_rules_data/data/schemas/github-workflow.json +1 -0
  8. codelaw_rules_data/data/schemas/package.json +1 -0
  9. codelaw_rules_data/data/schemas/pyproject.json +1 -0
  10. codelaw_rules_data/data/schemas/tsconfig.json +1 -0
  11. codelaw_rules_data/licenses/SchemaStore-Apache-2.0.txt +202 -0
  12. codelaw_rules_data/presets/data/conventions.toml +5 -0
  13. codelaw_rules_data/presets/data/github-actions.toml +6 -0
  14. codelaw_rules_data/presets/data/package-json.toml +7 -0
  15. codelaw_rules_data/presets/data/pyproject.toml +6 -0
  16. codelaw_rules_data/presets/data/recommended.toml +9 -0
  17. codelaw_rules_data/presets/data/tsconfig.toml +5 -0
  18. codelaw_rules_data/presets/md/recommended.toml +20 -0
  19. codelaw_rules_data/rules/json/no-duplicate-keys.cases.md +27 -0
  20. codelaw_rules_data/rules/json/no-duplicate-keys.md +45 -0
  21. codelaw_rules_data/rules/json/package-deps-sorted.cases.md +90 -0
  22. codelaw_rules_data/rules/json/package-deps-sorted.md +54 -0
  23. codelaw_rules_data/rules/json/package-engines.cases.md +24 -0
  24. codelaw_rules_data/rules/json/package-engines.md +45 -0
  25. codelaw_rules_data/rules/json/package-json-schema.md +57 -0
  26. codelaw_rules_data/rules/json/package-scripts-sorted.cases.md +45 -0
  27. codelaw_rules_data/rules/json/package-scripts-sorted.md +53 -0
  28. codelaw_rules_data/rules/json/tsconfig-schema.md +59 -0
  29. codelaw_rules_data/rules/json/tsconfig-strict.cases.md +57 -0
  30. codelaw_rules_data/rules/json/tsconfig-strict.md +45 -0
  31. codelaw_rules_data/rules/md/commands-show-output.cases.md +14 -0
  32. codelaw_rules_data/rules/md/commands-show-output.md +39 -0
  33. codelaw_rules_data/rules/md/descriptive-link-text.md +41 -0
  34. codelaw_rules_data/rules/md/fence-language.md +47 -0
  35. codelaw_rules_data/rules/md/first-line-heading.cases.md +28 -0
  36. codelaw_rules_data/rules/md/first-line-heading.md +46 -0
  37. codelaw_rules_data/rules/md/heading-increment.cases.md +61 -0
  38. codelaw_rules_data/rules/md/heading-increment.md +46 -0
  39. codelaw_rules_data/rules/md/link-fragments.cases.md +57 -0
  40. codelaw_rules_data/rules/md/link-fragments.md +49 -0
  41. codelaw_rules_data/rules/md/link-image-reference-definitions.cases.md +51 -0
  42. codelaw_rules_data/rules/md/link-image-reference-definitions.md +40 -0
  43. codelaw_rules_data/rules/md/no-alt-text.md +47 -0
  44. codelaw_rules_data/rules/md/no-bare-urls.cases.md +37 -0
  45. codelaw_rules_data/rules/md/no-bare-urls.md +37 -0
  46. codelaw_rules_data/rules/md/no-duplicate-heading.cases.md +19 -0
  47. codelaw_rules_data/rules/md/no-duplicate-heading.md +61 -0
  48. codelaw_rules_data/rules/md/no-emphasis-as-heading.cases.md +23 -0
  49. codelaw_rules_data/rules/md/no-emphasis-as-heading.md +49 -0
  50. codelaw_rules_data/rules/md/no-empty-links.md +50 -0
  51. codelaw_rules_data/rules/md/no-inline-html.cases.md +13 -0
  52. codelaw_rules_data/rules/md/no-inline-html.md +45 -0
  53. codelaw_rules_data/rules/md/no-reversed-links.md +33 -0
  54. codelaw_rules_data/rules/md/reference-links-images.cases.md +40 -0
  55. codelaw_rules_data/rules/md/reference-links-images.md +44 -0
  56. codelaw_rules_data/rules/md/relative-links.md +46 -0
  57. codelaw_rules_data/rules/md/single-h1.cases.md +29 -0
  58. codelaw_rules_data/rules/md/single-h1.md +57 -0
  59. codelaw_rules_data/rules/md/table-column-count.md +43 -0
  60. codelaw_rules_data/rules/toml/deps-sorted.cases.md +28 -0
  61. codelaw_rules_data/rules/toml/deps-sorted.md +49 -0
  62. codelaw_rules_data/rules/toml/no-duplicate-keys.cases.md +43 -0
  63. codelaw_rules_data/rules/toml/no-duplicate-keys.md +43 -0
  64. codelaw_rules_data/rules/toml/pyproject-requires-python.cases.md +24 -0
  65. codelaw_rules_data/rules/toml/pyproject-requires-python.md +41 -0
  66. codelaw_rules_data/rules/toml/pyproject-schema.md +55 -0
  67. codelaw_rules_data/rules/yaml/document-start.cases.md +31 -0
  68. codelaw_rules_data/rules/yaml/document-start.md +36 -0
  69. codelaw_rules_data/rules/yaml/gha-action-schema.md +59 -0
  70. codelaw_rules_data/rules/yaml/gha-pin-sha.cases.md +25 -0
  71. codelaw_rules_data/rules/yaml/gha-pin-sha.md +57 -0
  72. codelaw_rules_data/rules/yaml/gha-workflow-schema.md +57 -0
  73. codelaw_rules_data/rules/yaml/no-ambiguous-booleans.cases.md +29 -0
  74. codelaw_rules_data/rules/yaml/no-ambiguous-booleans.md +43 -0
  75. codelaw_rules_data/rules/yaml/no-ambiguous-numbers.cases.md +24 -0
  76. codelaw_rules_data/rules/yaml/no-ambiguous-numbers.md +46 -0
  77. codelaw_rules_data/rules/yaml/no-duplicate-keys.cases.md +35 -0
  78. codelaw_rules_data/rules/yaml/no-duplicate-keys.md +43 -0
  79. codelaw_rules_data/rules/yaml/no-undeclared-alias.cases.md +13 -0
  80. codelaw_rules_data/rules/yaml/no-undeclared-alias.md +46 -0
  81. codelaw_rules_data-0.2.0.dist-info/METADATA +140 -0
  82. codelaw_rules_data-0.2.0.dist-info/RECORD +84 -0
  83. codelaw_rules_data-0.2.0.dist-info/WHEEL +4 -0
  84. codelaw_rules_data-0.2.0.dist-info/licenses/LICENSE +23 -0
@@ -0,0 +1,40 @@
1
+ ---
2
+ id: md/link-image-reference-definitions
3
+ title: "Every reference definition is used, and defined once"
4
+ languages: [markdown]
5
+ fix: auto
6
+ stability: preview
7
+ options:
8
+ ignored_definitions: { type: "string[]", default: ["//"], description: "labels never reported (`[//]: # (…)` is a comment idiom)" }
9
+ ported_from: [markdownlint/MD053]
10
+ since: 0.1.0
11
+ ---
12
+
13
+ A `[label]: url` definition is referred to by some link or image, and no label is defined twice. The fix deletes the unused or repeated definition.
14
+
15
+ **Why:** A definition nothing uses is dead text that goes stale, and only the first of two definitions counts, so the second one misleads.
16
+
17
+ ```codelaw
18
+ native: md/link-image-reference-definitions
19
+ ```
20
+
21
+ ## Examples
22
+
23
+ ### Markdown
24
+
25
+ #### Don't
26
+
27
+ ````md
28
+ Read [the spec][spec].
29
+
30
+ [spec]: https://spec.commonmark.org/
31
+ [old]: https://example.com/old
32
+ ````
33
+
34
+ #### Do
35
+
36
+ ````md
37
+ Read [the spec][spec].
38
+
39
+ [spec]: https://spec.commonmark.org/
40
+ ````
@@ -0,0 +1,47 @@
1
+ ---
2
+ id: md/no-alt-text
3
+ title: "Images have alt text"
4
+ languages: [markdown]
5
+ fix: manual
6
+ fix_reason: "describing the image needs a person who can see it"
7
+ stability: preview
8
+ ported_from: [markdownlint/MD045]
9
+ since: 0.1.0
10
+ ---
11
+
12
+ A Markdown image has alt text: `![what it shows](…)`. HTML `<img>` elements are checked by `html/img-alt` in the HTML pack.
13
+
14
+ **Why:** Screen readers read the alt text in place of the image, and it shows when the image fails to load.
15
+
16
+ ```codelaw
17
+ match:
18
+ kind: image
19
+ not:
20
+ has: { kind: image_description }
21
+ message: "Describe the image in its alt text: `![what it shows](…)`"
22
+ ```
23
+
24
+ ## How to fix
25
+
26
+ 1. Look at the image and say in a few words what it shows.
27
+ 2. Put that between the brackets; for a purely decorative image, use HTML with `alt=""`.
28
+
29
+ ## Examples
30
+
31
+ ### Markdown
32
+
33
+ #### Don't
34
+
35
+ ````md
36
+ ![](diagram.png)
37
+ ````
38
+
39
+ #### Do
40
+
41
+ ````md
42
+ ![The request flow from client to cache](diagram.png)
43
+ ````
44
+
45
+ ## Differences from the source
46
+
47
+ markdownlint also checks HTML `<img>`; here that is the HTML pack's `html/img-alt`, which lints HTML embedded in Markdown.
@@ -0,0 +1,37 @@
1
+ # md/no-bare-urls — edge cases
2
+
3
+ ### case: already linked or in code
4
+
5
+ ````md
6
+ See <https://a.example>, [b](https://b.example), `https://c.example` and <a href="https://d.example">d</a>.
7
+ ````
8
+
9
+ ```expect
10
+ (none)
11
+ ```
12
+
13
+ ### case: closing parenthesis
14
+
15
+ ````md
16
+ Docs (https://example.com/a_(b)).
17
+ ````
18
+
19
+ ```expect
20
+ 1:7 md/no-bare-urls
21
+ ```
22
+
23
+ ````fixed
24
+ Docs (<https://example.com/a_(b)>).
25
+ ````
26
+
27
+ ### case: other schemes and rejected links
28
+
29
+ ````md
30
+ Repository: git+https://github.com/a/b.git
31
+
32
+ By [Ann Lee](https://github.com/Ann Lee).
33
+ ````
34
+
35
+ ```expect
36
+ (none)
37
+ ```
@@ -0,0 +1,37 @@
1
+ ---
2
+ id: md/no-bare-urls
3
+ title: "URLs are links, not bare text"
4
+ languages: [markdown]
5
+ fix: auto
6
+ stability: preview
7
+ ported_from: [markdownlint/MD034]
8
+ since: 0.1.0
9
+ ---
10
+
11
+ A URL in running text is wrapped in angle brackets, `<https://…>`, or written as a link. URLs in code spans, links, autolinks and HTML are left alone.
12
+
13
+ **Why:** CommonMark only links a URL in angle brackets; a bare one is plain text in many renderers.
14
+
15
+ ```codelaw
16
+ native: md/no-bare-urls
17
+ ```
18
+
19
+ ## Examples
20
+
21
+ ### Markdown
22
+
23
+ #### Don't
24
+
25
+ ````md
26
+ The docs are at https://example.com/docs.
27
+ ````
28
+
29
+ #### Do
30
+
31
+ ````md
32
+ The docs are at <https://example.com/docs>.
33
+ ````
34
+
35
+ ## Differences from the source
36
+
37
+ Bare e-mail addresses are not reported.
@@ -0,0 +1,19 @@
1
+ # md/no-duplicate-heading — edge cases
2
+
3
+ ### case: changelog sections
4
+
5
+ ````md
6
+ # Changelog
7
+
8
+ ## 1.1.0
9
+
10
+ ### Fixed
11
+
12
+ ## 1.0.0
13
+
14
+ ### Fixed
15
+ ````
16
+
17
+ ```expect
18
+ (none)
19
+ ```
@@ -0,0 +1,61 @@
1
+ ---
2
+ id: md/no-duplicate-heading
3
+ title: "No two sibling headings with the same text"
4
+ languages: [markdown]
5
+ fix: manual
6
+ fix_reason: "which heading to rename, and to what, needs the author"
7
+ stability: preview
8
+ options:
9
+ siblings_only: { type: "boolean", default: true, description: "only compare headings under the same parent; `false` compares every heading in the document" }
10
+ ported_from: [markdownlint/MD024]
11
+ since: 0.1.0
12
+ ---
13
+
14
+ Headings under the same parent heading have different text.
15
+
16
+ **Why:** Readers and tables of contents tell sections apart by their headings, and repeated headings get anchors (`#setup`, `#setup-1`) that are easy to link to the wrong one.
17
+
18
+ ```codelaw
19
+ native: md/no-duplicate-heading
20
+ ```
21
+
22
+ ## How to fix
23
+
24
+ 1. Decide whether the two sections are one topic; if so, merge them.
25
+ 2. Otherwise rename one heading to say how it differs.
26
+
27
+ ## Examples
28
+
29
+ ### Markdown
30
+
31
+ #### Don't
32
+
33
+ ````md
34
+ # Tools
35
+
36
+ ## Setup
37
+
38
+ Install the CLI.
39
+
40
+ ## Setup
41
+
42
+ Configure it.
43
+ ````
44
+
45
+ #### Do
46
+
47
+ ````md
48
+ # Tools
49
+
50
+ ## Setup
51
+
52
+ Install the CLI.
53
+
54
+ ## Configuration
55
+
56
+ Configure it.
57
+ ````
58
+
59
+ ## Differences from the source
60
+
61
+ `siblings_only` defaults to `true` here (markdownlint defaults it to `false`), so a changelog's repeated `### Fixed` under each version is not reported.
@@ -0,0 +1,23 @@
1
+ # md/no-emphasis-as-heading — edge cases
2
+
3
+ ### case: emphasis inside a sentence
4
+
5
+ ````md
6
+ Use **only** this.
7
+
8
+ *Note: it is slow.*
9
+ ````
10
+
11
+ ```expect
12
+ (none)
13
+ ```
14
+
15
+ ### case: emphasis around a link
16
+
17
+ ````md
18
+ *For version 1, see [the old docs](v1.md)*
19
+ ````
20
+
21
+ ```expect
22
+ (none)
23
+ ```
@@ -0,0 +1,49 @@
1
+ ---
2
+ id: md/no-emphasis-as-heading
3
+ title: "Headings are headings, not bold lines"
4
+ languages: [markdown]
5
+ fix: manual
6
+ fix_reason: "which heading level the line should become depends on the outline"
7
+ stability: preview
8
+ options:
9
+ punctuation: { type: "string", default: ".,;:!?。,;:!?", description: "a line ending in one of these is a sentence, not a heading" }
10
+ ported_from: [markdownlint/MD036]
11
+ since: 0.1.0
12
+ ---
13
+
14
+ A paragraph that is a single line of bold or italic text, standing alone, is a heading. Lines ending in punctuation are sentences and are not reported.
15
+
16
+ **Why:** Emphasis only looks like a heading: it doesn't appear in the outline, gets no anchor and isn't announced as a heading by screen readers.
17
+
18
+ ```codelaw
19
+ native: md/no-emphasis-as-heading
20
+ ```
21
+
22
+ ## How to fix
23
+
24
+ 1. Pick the level the section belongs at.
25
+ 2. Replace the emphasis with a heading of that level.
26
+
27
+ ## Examples
28
+
29
+ ### Markdown
30
+
31
+ #### Don't
32
+
33
+ ````md
34
+ # Guide
35
+
36
+ **Installation**
37
+
38
+ Run the installer.
39
+ ````
40
+
41
+ #### Do
42
+
43
+ ````md
44
+ # Guide
45
+
46
+ ## Installation
47
+
48
+ Run the installer.
49
+ ````
@@ -0,0 +1,50 @@
1
+ ---
2
+ id: md/no-empty-links
3
+ title: "Links have a destination"
4
+ languages: [markdown]
5
+ fix: manual
6
+ fix_reason: "where the link should go needs the author"
7
+ stability: preview
8
+ ported_from: [markdownlint/MD042]
9
+ since: 0.1.0
10
+ ---
11
+
12
+ A link has a destination: not `()`, `(<>)` or a bare `(#)`.
13
+
14
+ **Why:** An empty link looks clickable but goes nowhere, usually because a URL was never filled in.
15
+
16
+ ```codelaw
17
+ match:
18
+ kind: inline_link
19
+ any:
20
+ - not: { has: { kind: link_destination } }
21
+ - has: { kind: link_destination, regex: '^(#|<>|<#>)$' }
22
+ message: "This link goes nowhere; give it a destination"
23
+ ```
24
+
25
+ ## How to fix
26
+
27
+ 1. Find where the link should point.
28
+ 2. Write that destination, or remove the link and keep its text.
29
+
30
+ ## Examples
31
+
32
+ ### Markdown
33
+
34
+ #### Don't
35
+
36
+ ````md
37
+ See [the changelog]().
38
+ ````
39
+
40
+ #### Don't
41
+
42
+ ````md
43
+ See [the changelog](#).
44
+ ````
45
+
46
+ #### Do
47
+
48
+ ````md
49
+ See [the changelog](CHANGELOG.md).
50
+ ````
@@ -0,0 +1,13 @@
1
+ # md/no-inline-html — edge cases
2
+
3
+ ### case: comments and allowed closing tags
4
+
5
+ ````md
6
+ <!-- generated -->
7
+
8
+ Text.
9
+ ````
10
+
11
+ ```expect
12
+ (none)
13
+ ```
@@ -0,0 +1,45 @@
1
+ ---
2
+ id: md/no-inline-html
3
+ title: "No raw HTML in Markdown"
4
+ languages: [markdown]
5
+ fix: manual
6
+ fix_reason: "the Markdown equivalent, if there is one, needs the author"
7
+ stability: preview
8
+ options:
9
+ allowed_elements: { type: "string[]", default: [], description: "element names that may be used, such as `details` or `kbd`" }
10
+ ported_from: [markdownlint/MD033]
11
+ since: 0.1.0
12
+ ---
13
+
14
+ A Markdown document doesn't use raw HTML elements, except those listed in `allowed_elements`. HTML comments are not reported.
15
+
16
+ **Why:** Raw HTML ties the document to renderers that pass it through; many (GitHub among them) strip some of it, and it hides the structure Markdown tools read.
17
+
18
+ ```codelaw
19
+ native: md/no-inline-html
20
+ ```
21
+
22
+ ## How to fix
23
+
24
+ 1. Rewrite the element in Markdown where an equivalent exists.
25
+ 2. Where none does, add the element to `allowed_elements`.
26
+
27
+ ## Examples
28
+
29
+ ### Markdown
30
+
31
+ #### Don't
32
+
33
+ ````md
34
+ <b>Note:</b> back up first.
35
+ ````
36
+
37
+ #### Do
38
+
39
+ ````md
40
+ **Note:** back up first.
41
+ ````
42
+
43
+ ## Notes
44
+
45
+ This rule is in `data/conventions`, not `md/recommended`: most READMEs rely on HTML for layout (centred logos, `<details>`), so it is a house style rather than a correctness check.
@@ -0,0 +1,33 @@
1
+ ---
2
+ id: md/no-reversed-links
3
+ title: "Links are written [text](url), not (text)[url]"
4
+ languages: [markdown]
5
+ fix: auto
6
+ stability: preview
7
+ ported_from: [markdownlint/MD011]
8
+ since: 0.1.0
9
+ ---
10
+
11
+ Text written as `(text)[url]` is a link with its brackets swapped. Footnote references such as `(note)[^1]` are not reported.
12
+
13
+ **Why:** The reversed form doesn't render as a link: readers see the brackets and the raw URL.
14
+
15
+ ```codelaw
16
+ native: md/no-reversed-links
17
+ ```
18
+
19
+ ## Examples
20
+
21
+ ### Markdown
22
+
23
+ #### Don't
24
+
25
+ ````md
26
+ Read (the guide)[https://example.com/guide].
27
+ ````
28
+
29
+ #### Do
30
+
31
+ ````md
32
+ Read [the guide](https://example.com/guide).
33
+ ````
@@ -0,0 +1,40 @@
1
+ # md/reference-links-images — edge cases
2
+
3
+ ### case: shortcuts and task lists
4
+
5
+ ````md
6
+ - [x] done
7
+ - [ ] todo
8
+
9
+ See [CommonMark].
10
+ ````
11
+
12
+ ```expect
13
+ (none)
14
+ ```
15
+
16
+ ### case: labels ignore case
17
+
18
+ ````md
19
+ Read [the spec][Spec].
20
+
21
+ [spec]: https://spec.commonmark.org/
22
+ ````
23
+
24
+ ```expect
25
+ (none)
26
+ ```
27
+
28
+ ### case: definition of a fragment
29
+
30
+ ````md
31
+ Jump to [the end][end].
32
+
33
+ ## End
34
+
35
+ [end]: #end
36
+ ````
37
+
38
+ ```expect
39
+ (none)
40
+ ```
@@ -0,0 +1,44 @@
1
+ ---
2
+ id: md/reference-links-images
3
+ title: "Reference links use a label that is defined"
4
+ languages: [markdown]
5
+ fix: manual
6
+ fix_reason: "where the reference should point needs the author"
7
+ stability: preview
8
+ options:
9
+ ignored_labels: { type: "string[]", default: ["x"], description: "labels never reported (`x` is a task-list checkbox)" }
10
+ shortcut_syntax: { type: "boolean", default: false, description: "also check `[label]` shortcuts, which plain bracketed text looks like" }
11
+ ported_from: [markdownlint/MD052]
12
+ since: 0.1.0
13
+ ---
14
+
15
+ A reference link or image — `[text][label]`, `[label][]`, `![alt][label]` — uses a label that a `[label]: url` definition in the document defines. Labels match ignoring case and spacing.
16
+
17
+ **Why:** A reference to an undefined label isn't a link at all: it renders as the literal brackets.
18
+
19
+ ```codelaw
20
+ native: md/reference-links-images
21
+ ```
22
+
23
+ ## How to fix
24
+
25
+ 1. Check the label for a typo against the definitions.
26
+ 2. Fix the label, or add the missing `[label]: url` definition.
27
+
28
+ ## Examples
29
+
30
+ ### Markdown
31
+
32
+ #### Don't
33
+
34
+ ````md
35
+ Read [the spec][spec].
36
+ ````
37
+
38
+ #### Do
39
+
40
+ ````md
41
+ Read [the spec][spec].
42
+
43
+ [spec]: https://spec.commonmark.org/
44
+ ````
@@ -0,0 +1,46 @@
1
+ ---
2
+ id: md/relative-links
3
+ title: "Relative links point at a file that exists"
4
+ languages: [markdown]
5
+ fix: manual
6
+ fix_reason: "whether the file moved, was renamed or was never written needs the author"
7
+ stability: preview
8
+ since: 0.1.0
9
+ ---
10
+
11
+ A link or image whose destination is a path, not a URL, names a file or folder of the project. The path is read from the linking file's folder (from the project root when it starts with `/`), without its `#fragment` or `?query`. Links with a scheme (`https:`, `mailto:`), in-page `#fragments`, template syntax and paths that leave the project are not checked.
12
+
13
+ **Why:** A relative link breaks silently when the file it names is moved or renamed; the reader gets a 404 where the documentation should be.
14
+
15
+ ```codelaw
16
+ native: md/relative-links
17
+ ```
18
+
19
+ ## How to fix
20
+
21
+ 1. Find where the file went: `git log --follow --stat -- <path>` shows a rename.
22
+ 2. Point the link at the file's new path, or remove the link if the file is gone.
23
+
24
+ ## Examples
25
+
26
+ ### Markdown
27
+
28
+ #### Don't
29
+
30
+ ````md
31
+ <!-- docs/guide.md -->
32
+ Start with [the setup](./setup.md), then read the [FAQ](../FAQ.md).
33
+ <!-- docs/setup.md -->
34
+ # Setup
35
+ ````
36
+
37
+ #### Do
38
+
39
+ ````md
40
+ <!-- docs/guide.md -->
41
+ Start with [the setup](./setup.md), then read the [FAQ](../FAQ.md).
42
+ <!-- docs/setup.md -->
43
+ # Setup
44
+ <!-- FAQ.md -->
45
+ # FAQ
46
+ ````
@@ -0,0 +1,29 @@
1
+ # md/single-h1 — edge cases
2
+
3
+ ### case: front matter title
4
+
5
+ ````md
6
+ ---
7
+ title: Guide
8
+ ---
9
+
10
+ # Guide
11
+ ````
12
+
13
+ ```expect
14
+ 5:1 md/single-h1
15
+ ```
16
+
17
+ ### case: setext headings count
18
+
19
+ ````md
20
+ Guide
21
+ =====
22
+
23
+ Usage
24
+ =====
25
+ ````
26
+
27
+ ```expect
28
+ 4:1 md/single-h1
29
+ ```
@@ -0,0 +1,57 @@
1
+ ---
2
+ id: md/single-h1
3
+ title: "One level-1 heading per document"
4
+ languages: [markdown]
5
+ fix: manual
6
+ fix_reason: "which heading is the title, and what level the others become, needs the author"
7
+ stability: preview
8
+ options:
9
+ level: { type: "integer", default: 1, description: "the level of the title heading" }
10
+ ported_from: [markdownlint/MD025]
11
+ since: 0.1.0
12
+ ---
13
+
14
+ A document has one top-level heading, its title. Every later level-1 heading is reported; when the front matter has a `title:`, every level-1 heading is.
15
+
16
+ **Why:** The level-1 heading names the document; a second one splits the outline in two and gives the page two titles.
17
+
18
+ ```codelaw
19
+ native: md/single-h1
20
+ ```
21
+
22
+ ## How to fix
23
+
24
+ 1. Keep the heading that names the document at level 1.
25
+ 2. Make the others level 2 and shift their subsections down to match.
26
+
27
+ ## Examples
28
+
29
+ ### Markdown
30
+
31
+ #### Don't
32
+
33
+ ````md
34
+ # Guide
35
+
36
+ Intro.
37
+
38
+ # Usage
39
+
40
+ Steps.
41
+ ````
42
+
43
+ #### Do
44
+
45
+ ````md
46
+ # Guide
47
+
48
+ Intro.
49
+
50
+ ## Usage
51
+
52
+ Steps.
53
+ ````
54
+
55
+ ## Differences from the source
56
+
57
+ markdownlint applies the rule only when the first line of the file is the level-1 heading; here the first level-1 heading anywhere is the title, so a README that starts with badges is checked too.