Skip to content
This repository has been archived by the owner on May 27, 2021. It is now read-only.

Add option for unordered list style of TOC #61

Open
nicpitsch opened this issue Sep 27, 2018 · 4 comments
Open

Add option for unordered list style of TOC #61

nicpitsch opened this issue Sep 27, 2018 · 4 comments

Comments

@nicpitsch
Copy link

nicpitsch commented Sep 27, 2018

Issue

The created TOC uses dash (-) as symbol for the generated unordered list items. If the document contains another symbol for the list items, like asterix (*), markdownlint mentions MD004 - Unordered list style telling the unordered list style should be consistent within the document.

Example:

# Test1

<!-- TOC -->

- [heading 1](#heading-1)
- [Next heading](#next-heading)

<!-- /TOC -->

## heading 1

This is an unordered list, using asterix symbol:

* one
* two

## Next heading

Suggestion

Add an option for unorderd list symbol style, allowing the user to select the preferred symbol, means dash, asterix or plus.

Code

Extension.js

...
this.options = {
  DEPTH_FROM: 1,
  DEPTH_TO: 6,
  INSERT_ANCHOR: false,
  WITH_LINKS: true,
  ORDERED_LIST: false,
  UNORDERED_LIST_SYMBOL: '-',
  UPDATE_ON_SAVE: true,
  ANCHOR_MODE: ANCHOR_MODE_LIST[0]
};
...
// about line 282:
_this.options.ORDERED_LIST ? (++indicesOfDepth[length] + '. ') : '' + _this.options.UNORDERED_LIST_SYMBOL + '' + ' ',
@PhilippeCuvillier
Copy link

PhilippeCuvillier commented Oct 15, 2018

Thanks for raising issue. I agree with this request. This would a great idea as it would allow combining markdown TOC and markdown-lint.

@csonuryilmaz
Copy link

Hi @PhilippeCuvillier , is there any target milestone for this feature to be implemented? My .md document contains * for unordered lists and after TOC is created, markdownlint gives ~100+ warning. 😊 I 'll replace them to - as I don't want to give up from TOC.

@arnauldvm
Copy link

@nicpitsch @csonuryilmaz : As a workaround, you may add <!-- markdownlint-disable MD004 --> just before the TOC, and <!-- markdownlint-enable MD004 --> just after, to avoid warnings from markdownlint.

@rcdailey
Copy link

Where are we on this 1 year later?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants