remarkjs / remark-toc

plugin to generate a table of contents (TOC)

Home Page:https://remark.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Indentation of Table of content?

denysdovhan opened this issue · comments

I use tight option with remark-toc and get this result:

-   [Terms](#terms)
    -   [Term 1](#term-1)
    -   [Term 2](#term-2)
    -   [Term 3](#term-3)
-   [Organization](#organization)
-   [Events](#events)
-   [Resources](#resources)
-   [License](#license)

Here I have indentation in 4 spaces for each level, but I prefer to use 2 spaces. Is there a way to change indentation level?

commented

👋

Yup, you can set listItemIndent to 1 in the stringification options.

I didn't understand. If I have this configuration in my package.json, where exactly should I pass this option?

{
  "remarkConfig": {
    "plugins": {
      "toc": {
        "tight": true
      }
    }
  }
}
commented

Ah, on the CLI you can store that in remarkConfig.settings (e.g., remarkConfig: {settings: {listItemIndent: '1'}}).

Thank you 👍
Works for me!

commented

Perfect!