Commit 4fb7fc0
[Repo Assist] fix: Markdown.ToMd preserves tight list formatting (#1157)
* fix: Markdown.ToMd preserves tight list formatting
Tight lists (no blank lines between items in source) were converted to
loose lists by ToMd because the list serialiser always emitted a blank
line after every item.
Root cause: the Unordered and Ordered ListBlock arms in formatParagraph
unconditionally yielded "" after each item, regardless of whether the
list was tight or loose.
Fix: detect a tight list (every item is a single Span paragraph, as
produced by the parser for simple/tight items) and suppress inter-item
blank lines. A single trailing blank line is still emitted after the
entire list so the document structure is preserved.
Added three tests:
- tight unordered list round-trip (no blank lines)
- tight ordered list round-trip (no blank lines)
- loose list round-trip (items with blank lines preserved)
All 284 Markdown tests pass.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* ci: trigger checks
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Don Syme <dsyme@users.noreply.github.com>1 parent 86ee78f commit 4fb7fc0
File tree
3 files changed
+48
-0
lines changed- src/FSharp.Formatting.Markdown
- tests/FSharp.Markdown.Tests
3 files changed
+48
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
202 | 209 | | |
203 | 210 | | |
204 | 211 | | |
| |||
210 | 217 | | |
211 | 218 | | |
212 | 219 | | |
| 220 | + | |
213 | 221 | | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
214 | 225 | | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
215 | 233 | | |
216 | 234 | | |
217 | 235 | | |
| |||
223 | 241 | | |
224 | 242 | | |
225 | 243 | | |
| 244 | + | |
226 | 245 | | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
227 | 249 | | |
228 | 250 | | |
229 | 251 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1303 | 1303 | | |
1304 | 1304 | | |
1305 | 1305 | | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
1306 | 1331 | | |
1307 | 1332 | | |
1308 | 1333 | | |
| |||
0 commit comments