Skip to content

feat: Add ability for different symbol per level#353

Merged
AndrewSouthpaw merged 5 commits into
thlorenz:masterfrom
thompson-tomo:feat/list_symbol_#263
Jun 6, 2026
Merged

feat: Add ability for different symbol per level#353
AndrewSouthpaw merged 5 commits into
thlorenz:masterfrom
thompson-tomo:feat/list_symbol_#263

Conversation

@thompson-tomo

Copy link
Copy Markdown
Contributor

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-prefix list.
  • 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.

Comment thread README.md Outdated
Comment thread lib/transform.js Outdated
Comment thread lib/transform.js Outdated
Comment thread README.md Outdated
@thompson-tomo thompson-tomo force-pushed the feat/list_symbol_#263 branch from 48d9f15 to 1a3b82b Compare April 27, 2026 04:14
@thompson-tomo

Copy link
Copy Markdown
Contributor Author

@AndrewSouthpaw could you take a look at this one?

Comment thread doctoc.js Outdated
var title = argv.t || argv.title;
var notitle = argv.T || argv.notitle;
var entryPrefix = argv.entryprefix || '-';
var entryPrefix = argv.entryprefix?.trim().replace(' ', '');

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.replaceAll, otherwise "- , * , +" will fail.

Comment thread doctoc.js Outdated
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); }

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

",*,+" passes validation but would also break.

@thompson-tomo

Copy link
Copy Markdown
Contributor Author

@AndrewSouthpaw changes have been made, thanks for spotting them.

@AndrewSouthpaw AndrewSouthpaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a follow-up IMO it'd be nice to cover some of those other validation cases

@AndrewSouthpaw AndrewSouthpaw merged commit be3cacc into thlorenz:master Jun 6, 2026
5 checks passed
@thompson-tomo thompson-tomo deleted the feat/list_symbol_#263 branch June 7, 2026 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants