feat: Add ability for different symbol per level#353
Conversation
There was a problem hiding this comment.
Pull request overview
Adds support for specifying different unordered list symbols per TOC nesting level via --entry-prefix, addressing #263’s request to align generated TOCs with a project’s existing markdownlint UL style.
Changes:
- Extend TOC generation to select a bullet symbol per header level from a comma-separated
--entry-prefixlist. - Add a transform test covering multi-level symbol cycling (
-,*,+). - Document the new per-level symbol configuration in the README.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
lib/transform.js |
Splits entryPrefix into per-level symbols and selects a symbol based on nesting level. |
test/transform.js |
Adds coverage for per-level bullet symbols in generated TOC output. |
README.md |
Documents --entry-prefix for single and per-level list symbols and links it in the README TOC. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
48d9f15 to
1a3b82b
Compare
|
@AndrewSouthpaw could you take a look at this one? |
| var title = argv.t || argv.title; | ||
| var notitle = argv.T || argv.notitle; | ||
| var entryPrefix = argv.entryprefix || '-'; | ||
| var entryPrefix = argv.entryprefix?.trim().replace(' ', ''); |
There was a problem hiding this comment.
.replaceAll, otherwise "- , * , +" will fail.
| var notitle = argv.T || argv.notitle; | ||
| var entryPrefix = argv.entryprefix || '-'; | ||
| var entryPrefix = argv.entryprefix?.trim().replace(' ', ''); | ||
| if (entryPrefix?.endsWith(',') || entryPrefix?.includes(',,')) { log.error('Invalid entry prefix: ' + entryPrefix), printUsageAndExit(true); } |
There was a problem hiding this comment.
",*,+" passes validation but would also break.
|
@AndrewSouthpaw changes have been made, thanks for spotting them. |
AndrewSouthpaw
left a comment
There was a problem hiding this comment.
As a follow-up IMO it'd be nice to cover some of those other validation cases
Progresses #263
This enables the symbol used in unordered toc to differ on a per level basis.
This further assists with adoption as the tool can now work with whatever list symbol/s is used in the doc