# markdown-it-wiki-toc

> Markdown-it plugin to add Wiki style Table Of Contents

Latest version **1.0.4** (published 2019-01-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install markdown-it-wiki-toc
pnpm add markdown-it-wiki-toc
yarn add markdown-it-wiki-toc
bun add markdown-it-wiki-toc
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2019-01-17 |
| First published | 2019-01-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 10.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 18 |
| Author | Dongho Yu |
| Maintainers | n0rr7882 |
| Keywords | markdown, markdown-it, markdown-it-plugin, markdown-it-wiki, markdown-it-toc |

## Links

- npm: https://www.npmjs.com/package/markdown-it-wiki-toc
- Repository: https://github.com/peoplefund-tech/markdown-it-wiki-toc
- Homepage: https://github.com/peoplefund-tech/markdown-it-wiki-toc#readme
- Issues: https://github.com/peoplefund-tech/markdown-it-wiki-toc/issues
- npm.io page: https://npm.io/package/markdown-it-wiki-toc

## Alternatives

- [@mdxeditor/editor](https://npm.io/package/@mdxeditor/editor.md) — 962.4K weekly downloads
- [mmdb-lib](https://npm.io/package/mmdb-lib.md) — 680.9K weekly downloads
- [playcanvas](https://npm.io/package/playcanvas.md) — 36.2K weekly downloads
- [@glw907/cairn-cms](https://npm.io/package/@glw907/cairn-cms.md) — 967 weekly downloads
- [markdown-to-confluence](https://npm.io/package/markdown-to-confluence.md) — 103 weekly downloads

## Recent versions

- 1.0.4 (latest) — 2019-01-17
- 1.0.3 — 2019-01-15
- 1.0.2 — 2019-01-06
- 1.0.1 — 2019-01-06
- 1.0.0 — 2019-01-06

## README

# markdown-it-wiki-toc

[![Version](https://img.shields.io/npm/v/markdown-it-wiki-toc.svg)](https://www.npmjs.com/package/markdown-it-wiki-toc)

> Markdown-it plugin to add Wiki style Table Of Contents

## Installation

```
$ npm install --save markdown-it-wiki-toc
```

## Usage

```js
var markdownIt = require('markdown-it');

markdownIt({
    html: true,
    linkify: true,
    typographer: true,
})
    .use(require('markdown-it-wiki-toc'), {
        // ...options
    })
    .render(mdText);
```

### Results

```html
<p>
    <div id="toc" class="toc">
        <h3>Table of Contents</h3>
        <ul class="toc-level">
            <li><a href="#h-1">1.</a> Heading 1</li>
            <ul class="toc-level">
                <li><a href="#h-1.1">1.1.</a> Heading 2</li>
                <ul class="toc-level">
                    <li><a href="#h-1.1.1">1.1.1.</a> Heading 3</li>
                </ul>
                <li><a href="#h-1.2">1.2.</a> Heading 2</li>
                <ul class="toc-level">
                    <li><a href="#h-1.2.1">1.2.1.</a> Heading 3</li>
                </ul>
            </ul>
        </ul>
    </div>
</p>
<h1><a href="#h-1" id="h-1">1.</a> Heading 1</h1>
<h2><a href="#h-1.1" id="h-1.1">1.1.</a> Heading 2</h2>
<h3><a href="#h-1.1.1" id="h-1.1.1">1.1.1.</a> Heading 3</h3>
<h2><a href="#h-1.2" id="h-1.2">1.2.</a> Heading 2</h2>
<h3><a href="#h-1.2.1" id="h-1.2.1">1.2.1.</a> Heading 3</h3>
```

### Options

#### `tocRegexp` (RegExp)

default: `/@\[toc\]/im`

Regular expression to detect TOC in source.

#### `tocTitle` (string)

default: `'Table of Contents'`

Title of TOC.

#### `tocId` (string)

default: `'toc'`

HTML ID attribute of TOC wrapper.

#### `tocWrapperClass` (string)

default: `'toc'`

HTML Class attribute of TOC wrapper.

#### `tocLevelWrapperClass` (string)

default: `'toc-level'`

HTML Class attribute of level wrapper of TOC.

#### `anchorIdPrefix` (string)

default: `'h-'`

Prefix for each ID attribute of headings.

#### `reverseLink` (boolean)

default: `false`

Value of whether the link in the anchor of the heading points to TOC.

If the value is `true`, result is `<h?><a href="#toc">...</a>...</h?>`.

## Test

```
$ npm run test
```

## [LICENSE](LICENSE)

---
_Source: https://npm.io/package/markdown-it-wiki-toc · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
