|
1 | 1 | --- |
2 | 2 | id: 69 |
3 | 3 | title: 'Include enhancements: link adjustment and heading-level' |
4 | | -status: "🔲" |
| 4 | +status: "✅" |
5 | 5 | --- |
6 | 6 | # Include enhancements |
7 | 7 |
|
@@ -77,53 +77,53 @@ has `## Build` (level 2) and `### Sub` (level 3). |
77 | 77 |
|
78 | 78 | ## Tasks |
79 | 79 |
|
80 | | -1. Add a helper `adjustLinks(content, |
| 80 | +1. [x] Add a helper `adjustLinks(content, |
81 | 81 | includedFilePath, includingFilePath)` in |
82 | 82 | [`internal/rules/include/`](../internal/rules/include/) |
83 | 83 | that rewrites relative link/image targets |
84 | | -2. Write unit tests for `adjustLinks`: same directory |
| 84 | +2. [x] Write unit tests for `adjustLinks`: same directory |
85 | 85 | (no-op), different directories, anchors and |
86 | 86 | absolute URLs left untouched, query strings |
87 | 87 | preserved |
88 | | -3. Call `adjustLinks` in `generateIncludeContent` |
| 88 | +3. [x] Call `adjustLinks` in `generateIncludeContent` |
89 | 89 | after frontmatter stripping, before wrap |
90 | | -4. Add a helper `adjustHeadings(content, parentLevel)` |
| 90 | +4. [x] Add a helper `adjustHeadings(content, parentLevel)` |
91 | 91 | that shifts ATX and setext heading levels |
92 | | -5. Write unit tests for `adjustHeadings`: shift up, |
| 92 | +5. [x] Write unit tests for `adjustHeadings`: shift up, |
93 | 93 | shift down, cap at 6, no headings (no-op) |
94 | | -6. Extend `validateIncludeDirective` to accept and |
| 94 | +6. [x] Extend `validateIncludeDirective` to accept and |
95 | 95 | validate the `heading-level` parameter (only |
96 | 96 | `"absolute"` is valid) |
97 | | -7. In `generateIncludeContent`, detect the parent |
| 97 | +7. [x] In `generateIncludeContent`, detect the parent |
98 | 98 | heading level from the marker position and call |
99 | 99 | `adjustHeadings` when `heading-level: "absolute"` |
100 | | -8. Add test for parent-level detection (marker under |
| 100 | +8. [x] Add test for parent-level detection (marker under |
101 | 101 | h2, under h3, at document root) |
102 | | -9. Update the rule README at |
| 102 | +9. [x] Update the rule README at |
103 | 103 | [`MDS021-include/README.md`](../internal/rules/MDS021-include/README.md) |
104 | 104 | to document both features |
105 | | -10. Update existing fixtures and tests if link |
| 105 | +10. [x] Update existing fixtures and tests if link |
106 | 106 | adjustment changes their expected output |
107 | | -11. Run `go test ./...`, `go tool golangci-lint run`, |
| 107 | +11. [x] Run `go test ./...`, `go tool golangci-lint run`, |
108 | 108 | and `mdsmith check .` |
109 | 109 |
|
110 | 110 | ## Acceptance Criteria |
111 | 111 |
|
112 | | -- [ ] Relative links in included content are rewritten |
| 112 | +- [x] Relative links in included content are rewritten |
113 | 113 | so they resolve from the including file's |
114 | 114 | directory, not the source file's directory |
115 | | -- [ ] Absolute URLs, anchor-only links (`#foo`), and |
| 115 | +- [x] Absolute URLs, anchor-only links (`#foo`), and |
116 | 116 | protocol links (`http://`, `https://`) are not |
117 | 117 | modified |
118 | | -- [ ] `heading-level: "absolute"` shifts headings so |
| 118 | +- [x] `heading-level: "absolute"` shifts headings so |
119 | 119 | the included top-level headings appear one level |
120 | 120 | below the enclosing section |
121 | | -- [ ] When `heading-level` is omitted, heading levels |
| 121 | +- [x] When `heading-level` is omitted, heading levels |
122 | 122 | stay unchanged |
123 | | -- [ ] Heading level never exceeds 6 |
124 | | -- [ ] Invalid `heading-level` values produce a diagnostic |
125 | | -- [ ] Link adjustment is always applied (no parameter |
| 123 | +- [x] Heading level never exceeds 6 |
| 124 | +- [x] Invalid `heading-level` values produce a diagnostic |
| 125 | +- [x] Link adjustment is always applied (no parameter |
126 | 126 | needed) |
127 | | -- [ ] All tests pass: `go test ./...` |
128 | | -- [ ] `golangci-lint run` reports no issues |
129 | | -- [ ] `mdsmith check .` reports zero diagnostics |
| 127 | +- [x] All tests pass: `go test ./...` |
| 128 | +- [x] `golangci-lint run` reports no issues |
| 129 | +- [x] `mdsmith check .` reports zero diagnostics |
0 commit comments