Skip to content

Commit dcb8061

Browse files
author
merge-queue-bot
committed
Merge PR #206: Implement MDS045 list-marker-style rule
2 parents 43dfa16 + ea00cfb commit dcb8061

19 files changed

Lines changed: 985 additions & 18 deletions

PLAN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ footer: |
2525
| 106 || sonnet | [Emphasis style rule](plan/106_emphasis-style.md) |
2626
| 107 || opus | [No reference-style links rule](plan/107_no-reference-style.md) |
2727
| 108 | 🔲 | sonnet | [Horizontal rule style rule](plan/108_horizontal-rule-style.md) |
28-
| 109 | 🔲 | sonnet | [List marker style rule](plan/109_list-marker-style.md) |
28+
| 109 | | sonnet | [List marker style rule](plan/109_list-marker-style.md) |
2929
| 110 || sonnet | [Ordered list numbering rule](plan/110_ordered-list-numbering.md) |
3030
| 111 || sonnet | [Ambiguous emphasis rule](plan/111_ambiguous-emphasis.md) |
3131
| 112 || opus | [Markdown convention bundles for MDS034](plan/112_flavor-profiles.md) |

internal/integration/rules_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import (
3636
_ "github.com/jeduden/mdsmith/internal/rules/include"
3737
_ "github.com/jeduden/mdsmith/internal/rules/linelength"
3838
_ "github.com/jeduden/mdsmith/internal/rules/listindent"
39+
_ "github.com/jeduden/mdsmith/internal/rules/listmarkerstyle"
3940
_ "github.com/jeduden/mdsmith/internal/rules/markdownflavor"
4041
_ "github.com/jeduden/mdsmith/internal/rules/maxfilelength"
4142
_ "github.com/jeduden/mdsmith/internal/rules/maxsectionlength"
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
---
2+
id: MDS045
3+
name: list-marker-style
4+
status: ready
5+
description: Unordered list items must use the configured bullet marker character.
6+
---
7+
# MDS045: list-marker-style
8+
9+
Unordered list items must use the configured bullet marker character.
10+
11+
## Settings
12+
13+
| Setting | Type | Default | Description |
14+
|----------|--------------|----------|-----------------------------------------------------------|
15+
| `style` | string | `"dash"` | `"dash"` (`-`), `"asterisk"` (`*`), or `"plus"` (`+`) |
16+
| `nested` | list(string) | `[]` | Per-depth style rotation; cycles by `depth % len(nested)` |
17+
18+
## Config
19+
20+
Enable with dash style (the default when enabled):
21+
22+
```yaml
23+
rules:
24+
list-marker-style:
25+
style: dash
26+
```
27+
28+
Disable (default):
29+
30+
```yaml
31+
rules:
32+
list-marker-style: false
33+
```
34+
35+
Depth-based rotation (outer uses `-`, inner uses `*`):
36+
37+
```yaml
38+
rules:
39+
list-marker-style:
40+
nested:
41+
- dash
42+
- asterisk
43+
```
44+
45+
## Examples
46+
47+
### Good -- dash style
48+
49+
<?include
50+
file: good/dash.md
51+
wrap: markdown
52+
?>
53+
54+
```markdown
55+
# Good dash marker
56+
57+
This file uses dash markers consistently.
58+
59+
- First item
60+
- Second item
61+
- Third item
62+
63+
Nested list:
64+
65+
- Outer item
66+
- Inner item
67+
- Another inner item
68+
- Another outer item
69+
```
70+
71+
<?/include?>
72+
73+
### Good -- nested rotation
74+
75+
<?include
76+
file: good/nested.md
77+
wrap: markdown
78+
?>
79+
80+
```markdown
81+
# Good nested with rotation
82+
83+
Outer lists use dash, inner use asterisk.
84+
85+
- Outer item
86+
* Inner item
87+
* Another inner item
88+
- Another outer item
89+
* More inner
90+
- Depth 2 cycles back to dash
91+
* Depth 3 cycles to asterisk
92+
```
93+
94+
<?/include?>
95+
96+
### Bad -- wrong marker
97+
98+
<?include
99+
file: bad/asterisk-with-dash.md
100+
wrap: markdown
101+
?>
102+
103+
```markdown
104+
# Bad asterisk with dash config
105+
106+
This list uses asterisks but dash is configured.
107+
108+
* First item
109+
* Second item
110+
* Third item
111+
```
112+
113+
<?/include?>
114+
115+
### Bad -- wrong nested marker
116+
117+
<?include
118+
file: bad/nested-wrong.md
119+
wrap: markdown
120+
?>
121+
122+
```markdown
123+
# Bad nested with wrong inner marker
124+
125+
Outer uses dash (correct), inner should use asterisk but uses dash.
126+
127+
- Outer item
128+
- Inner item should be asterisk
129+
- Another inner item should be asterisk
130+
- Another outer item
131+
```
132+
133+
<?/include?>
134+
135+
## Meta-Information
136+
137+
- **ID**: MDS045
138+
- **Name**: `list-marker-style`
139+
- **Status**: ready
140+
- **Default**: disabled
141+
- **Fixable**: yes
142+
- **Implementation**:
143+
[source](./)
144+
- **Category**: list
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
settings:
3+
style: dash
4+
diagnostics:
5+
- line: 5
6+
column: 1
7+
message: "unordered list uses asterisk; configured style is dash"
8+
- line: 6
9+
column: 1
10+
message: "unordered list uses asterisk; configured style is dash"
11+
- line: 7
12+
column: 1
13+
message: "unordered list uses asterisk; configured style is dash"
14+
---
15+
# Bad asterisk with dash config
16+
17+
This list uses asterisks but dash is configured.
18+
19+
* First item
20+
* Second item
21+
* Third item
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
settings:
3+
style: asterisk
4+
diagnostics:
5+
- line: 5
6+
column: 1
7+
message: "unordered list uses dash; configured style is asterisk"
8+
- line: 6
9+
column: 1
10+
message: "unordered list uses dash; configured style is asterisk"
11+
- line: 7
12+
column: 1
13+
message: "unordered list uses dash; configured style is asterisk"
14+
---
15+
# Bad dash with asterisk config
16+
17+
This list uses dashes but asterisk is configured.
18+
19+
- First item
20+
- Second item
21+
- Third item
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
settings:
3+
nested:
4+
- dash
5+
- asterisk
6+
diagnostics:
7+
- line: 6
8+
column: 1
9+
message: "unordered list at depth 1 uses dash; expected asterisk"
10+
- line: 7
11+
column: 1
12+
message: "unordered list at depth 1 uses dash; expected asterisk"
13+
---
14+
# Bad nested with wrong inner marker
15+
16+
Outer uses dash (correct), inner should use asterisk but uses dash.
17+
18+
- Outer item
19+
- Inner item should be asterisk
20+
- Another inner item should be asterisk
21+
- Another outer item
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
settings:
3+
style: dash
4+
diagnostics:
5+
- line: 5
6+
column: 1
7+
message: "unordered list uses plus; configured style is dash"
8+
- line: 6
9+
column: 1
10+
message: "unordered list uses plus; configured style is dash"
11+
- line: 7
12+
column: 1
13+
message: "unordered list uses plus; configured style is dash"
14+
---
15+
# Bad plus with dash config
16+
17+
This list uses plus but dash is configured.
18+
19+
+ First item
20+
+ Second item
21+
+ Third item
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
settings:
3+
style: dash
4+
---
5+
# Bad asterisk with dash config
6+
7+
This list uses asterisks but dash is configured.
8+
9+
- First item
10+
- Second item
11+
- Third item
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
settings:
3+
style: asterisk
4+
---
5+
# Bad dash with asterisk config
6+
7+
This list uses dashes but asterisk is configured.
8+
9+
* First item
10+
* Second item
11+
* Third item
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
settings:
3+
nested:
4+
- dash
5+
- asterisk
6+
---
7+
# Bad nested with wrong inner marker
8+
9+
Outer uses dash (correct), inner should use asterisk but uses dash.
10+
11+
- Outer item
12+
* Inner item should be asterisk
13+
* Another inner item should be asterisk
14+
- Another outer item

0 commit comments

Comments
 (0)