Skip to content

Commit 4153ee8

Browse files
Copilotjeduden
andauthored
Address PR review: fix README front matter, delete duplicate fixtures, per-item diagnostics, ToStringSlice, mixed-marker tests
Agent-Logs-Url: https://github.com/jeduden/mdsmith/sessions/db9dbd84-c280-487a-9135-9bc191bf9eaf Co-authored-by: jeduden <1117699+jeduden@users.noreply.github.com>
1 parent d2a5a29 commit 4153ee8

22 files changed

Lines changed: 221 additions & 434 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) |
Lines changed: 92 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,38 @@
1-
# MDS045 - list-marker-style
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
28

3-
Enforce consistent bullet character for unordered lists.
9+
Unordered list items must use the configured bullet marker character.
410

5-
## Rationale
11+
## Settings
612

7-
CommonMark accepts three different characters for unordered list
8-
markers: `-`, `*`, and `+`. When a codebase mixes these markers,
9-
diffs become noisy (changing one marker to another shows up as a
10-
change even when the content is identical), and readers may wonder
11-
whether the different markers carry semantic meaning.
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)` |
1217

13-
This rule pins a single marker character project-wide, eliminating
14-
the three-way ambiguity and keeping diffs focused on content
15-
changes.
18+
## Config
1619

17-
## Default Configuration
20+
Enable with dash style (the default when enabled):
1821

1922
```yaml
2023
rules:
2124
list-marker-style:
22-
enabled: false # opt-in
23-
style: dash # dash | asterisk | plus
24-
nested: [] # optional list for depth rotation
25+
style: dash
2526
```
2627
27-
The rule is disabled by default. Users must explicitly enable it and
28-
choose a style.
29-
30-
## Settings
31-
32-
### `style`
33-
34-
The marker character to use for all unordered lists (when `nested`
35-
is empty).
36-
37-
- `dash`: Use `-`
38-
- `asterisk`: Use `*`
39-
- `plus`: Use `+`
28+
Disable (default):
4029
41-
### `nested`
42-
43-
Optional list of style names to cycle through by depth. When set,
44-
the marker at depth _n_ is `nested[n % len(nested)]`. Depth 0 is
45-
the outermost list.
30+
```yaml
31+
rules:
32+
list-marker-style: false
33+
```
4634
47-
Example rotating between dash and asterisk:
35+
Depth-based rotation (outer uses `-`, inner uses `*`):
4836

4937
```yaml
5038
rules:
@@ -54,69 +42,103 @@ rules:
5442
- asterisk
5543
```
5644

57-
With this configuration:
58-
- Depth 0 (outer) lists use `-`
59-
- Depth 1 (nested once) lists use `*`
60-
- Depth 2 (nested twice) lists use `-` again
61-
- And so on
62-
63-
When `nested` is empty (the default), all lists use `style`
64-
regardless of depth.
65-
6645
## Examples
6746

68-
### Good (style: dash)
47+
### Good -- dash style
48+
49+
<?include
50+
file: good/dash.md
51+
wrap: markdown
52+
?>
6953

7054
```markdown
55+
# Good dash marker
56+
57+
This file uses dash markers consistently.
58+
7159
- First item
7260
- Second item
7361
- Third item
74-
```
7562
76-
### Bad (style: dash)
63+
Nested list:
7764
78-
```markdown
79-
* First item
80-
* Second item
81-
* Third item
65+
- Outer item
66+
- Inner item
67+
- Another inner item
68+
- Another outer item
8269
```
8370

84-
The list uses `*` but the configured style is `dash`. The rule will
85-
flag this and auto-fix to `-`.
71+
<?/include?>
72+
73+
### Good -- nested rotation
8674

87-
### Good (nested: [dash, asterisk])
75+
<?include
76+
file: good/nested.md
77+
wrap: markdown
78+
?>
8879

8980
```markdown
81+
# Good nested with rotation
82+
83+
Outer lists use dash, inner use asterisk.
84+
9085
- Outer item
9186
* Inner item
9287
* Another inner item
9388
- Another outer item
89+
* More inner
90+
- Depth 2 cycles back to dash
91+
* Depth 3 cycles to asterisk
9492
```
9593

96-
### Bad (nested: [dash, asterisk])
94+
<?/include?>
95+
96+
### Bad -- wrong marker
97+
98+
<?include
99+
file: bad/asterisk-with-dash.md
100+
wrap: markdown
101+
?>
97102

98103
```markdown
99-
- Outer item
100-
- Inner item (should be asterisk)
101-
- Another inner item
102-
- Another outer item
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
103111
```
104112

105-
The inner list at depth 1 should use `*` but uses `-`.
113+
<?/include?>
114+
115+
### Bad -- wrong nested marker
106116

107-
## Interaction with Other Rules
117+
<?include
118+
file: bad/nested-wrong.md
119+
wrap: markdown
120+
?>
108121

109-
- **MDS016 (list-indent)**: Enforces proper indentation of nested
110-
lists. MDS045 only controls the marker character, not spacing.
111-
- **MDS046 (ordered-list-numbering)**: Applies to ordered lists
112-
(numbered), while MDS045 applies only to unordered lists (bulleted).
122+
```markdown
123+
# Bad nested with wrong inner marker
124+
125+
Outer uses dash (correct), inner should use asterisk but uses dash.
113126
114-
## Auto-fix
127+
- Outer item
128+
- Inner item should be asterisk
129+
- Another inner item should be asterisk
130+
- Another outer item
131+
```
115132

116-
The rule replaces the marker byte at the start of each list item.
117-
Because all three markers (`-`, `*`, `+`) are single bytes, the
118-
fix does not affect column alignment or indentation.
133+
<?/include?>
119134

120-
## Category
135+
## Meta-Information
121136

122-
`list`
137+
- **ID**: MDS045
138+
- **Name**: `list-marker-style`
139+
- **Status**: ready
140+
- **Default**: disabled
141+
- **Fixable**: yes
142+
- **Implementation**:
143+
[source](./)
144+
- **Category**: list

internal/rules/MDS045-list-marker-style/bad/asterisk-with-dash.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ diagnostics:
55
- line: 5
66
column: 1
77
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"
814
---
915
# Bad asterisk with dash config
1016

internal/rules/MDS045-list-marker-style/bad/dash-with-asterisk.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ diagnostics:
55
- line: 5
66
column: 1
77
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"
814
---
915
# Bad dash with asterisk config
1016

internal/rules/MDS045-list-marker-style/bad/nested-wrong.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ diagnostics:
77
- line: 6
88
column: 1
99
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"
1013
---
1114
# Bad nested with wrong inner marker
1215

internal/rules/MDS045-list-marker-style/bad/plus-with-dash.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ diagnostics:
55
- line: 5
66
column: 1
77
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"
814
---
915
# Bad plus with dash config
1016

internal/rules/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,6 @@ row: "| [{id}]({filename}) | `{name}` | {status} | {description} |"
5757
| [MDS036](MDS036-max-section-length/README.md) | `max-section-length` | ready | Section length must not exceed per-level or per-heading limits. |
5858
| [MDS037](MDS037-duplicated-content/README.md) | `duplicated-content` | ready | Paragraphs should not repeat verbatim across Markdown files. |
5959
| [MDS038](MDS038-toc/README.md) | `toc` | ready | Keep toc generated heading lists in sync with document headings. |
60+
| [MDS045](MDS045-list-marker-style/README.md) | `list-marker-style` | ready | Unordered list items must use the configured bullet marker character. |
6061
| [MDS046](MDS046-ordered-list-numbering/README.md) | `ordered-list-numbering` | ready | Ordered list items must be numbered in the configured style. |
6162
<?/catalog?>

0 commit comments

Comments
 (0)