Strip a leading heading (`#`), list bullet (`-`/`*`/`+`, `1.`) and/or task * checkbox (`[ ]`/`[x]`) so titles derived from list/task lines read cleanly.
(line: string)
| 53 | /** Strip a leading heading (`#`), list bullet (`-`/`*`/`+`, `1.`) and/or task |
| 54 | * checkbox (`[ ]`/`[x]`) so titles derived from list/task lines read cleanly. */ |
| 55 | function stripLeadingMarker(line: string): string { |
| 56 | return line |
| 57 | .replace(/^#+\s*/, '') |
| 58 | .replace(/^(?:[-*+]|\d+[.)])\s+/, '') |
| 59 | .replace(/^\[[ xX]\]\s*/, '') |
| 60 | .trim() |
| 61 | } |
| 62 | |
| 63 | function composeBody(title: string, body: string, tags: string[]): string { |
| 64 | const heading = `# ${title}\n\n` |