alanwalk / markdown-toc

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

Indentation Issue - MD007/ul-indent #60

Open jmcmaster05 opened 5 years ago

jmcmaster05 commented 5 years ago

Issue

Notice from VS Code - Markdown Lint (davidanson.vscode-markdownlint) MD007/ul-indent: Unordered list indentation [Expected: 2; Actual: 4] https://github.com/DavidAnson/markdownlint/blob/v0.11.0/doc/Rules.md#md007

Example

<!-- TOC -->

- [Generate SSH Key for SFTP Use](#generate-ssh-key-for-sftp-use)
    - [Table of Contents](#table-of-contents)
    - [References](#references)

Currently TOC uses 4 spaces for each indentation for the Unordered TOC list, instead of the standard 2 spaces.

Code

https://github.com/AlanWalk/markdown-toc/blob/1fc815ec26d063b38502932641a80497fbf71f24/src/extension.ts#L268

editor.tabSize is defaulted to 4.

Workaround

Create .markdownlint.json in project root per project. 😞

{
    "MD007": { "indent": 4 }
}

Please let me know if I've overlooked a setting or if you are aware of a better solution. I've researched https://github.com/neilsustc/vscode-markdown/issues/155

kenorb commented 4 years ago

The extension is using exactly what you've in the settings (Editor: Tab Size). If you set it to 2, then the plugin will regenerate TOC with indention of 2 spaces. So this could be the issue with markdownlint.

Related: DavidAnson/markdownlint/issues/210

DavidAnson commented 4 years ago

I looked into this for the related issue in the vscode-markdownlint project. Short version is that I do not think this is a good use of editor.tabSize. Long version: https://github.com/DavidAnson/vscode-markdownlint/issues/86#issuecomment-579860824