markdown-toc icon indicating copy to clipboard operation
markdown-toc copied to clipboard

Indentation Issue - MD007/ul-indent

Open jmcmaster05 opened this issue 7 years ago • 2 comments

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

jmcmaster05 avatar Sep 19 '18 17:09 jmcmaster05

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

kenorb avatar Aug 05 '19 09:08 kenorb

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

DavidAnson avatar Jan 31 '20 05:01 DavidAnson