alanwalk / markdown-toc

MarkdownTOC(Table Of Contents) Plugin for Visual Studio Code.
MIT License
141 stars 111 forks source link

Add option for unordered list style of TOC #61

Open nicpitsch opened 6 years ago

nicpitsch commented 6 years ago

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 commented 5 years ago

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 commented 5 years ago

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. :blush: I 'll replace them to - as I don't want to give up from TOC.

arnauldvm commented 5 years ago

@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 commented 4 years ago

Where are we on this 1 year later?