<commit_before># marked-toc [![NPM version](https://badge.fury.io/js/marked-toc.png)](http://badge.fury.io/js/marked-toc)

> Generate a TOC (table of contents) for markdown files

_(example)_
<!-- toc -->
* [Getting Started](#getting-started)
* [Usage](#usage)
* [Options](#options)
  * [template](#template)
  * [bullet](#bullet)
  * [firsth1](#firsth1)
  * [omit](#omit)
  * [clean](#clean)
  * [blacklist](#blacklist)
  * [allowedChars](#allowedchars)
* [API](#api)
  * [toc](#toc)
  * [toc.insert](#tocinsert)
  * [toc.add](#tocadd)
  * [toc.raw](#tocraw)
* [Contributing](#contributing)
* [Author](#author)
* [License](#license)

<!-- toc stop -->

## Getting Started

Install the module with [npm](npmjs.org):

```bash
npm i marked-toc --save
```

In any markdown file, add `<!-- toc -->` where you want to add the TOC. Then in the command line, run:

```bash
toc [filename]
```

To add a TOC to your project's README.md, add `<!-- toc -->` and run:

```bash
toc
```

## Usage

```javascript
var toc = require('marked-toc');
var file = fs.readFileSync('README.md', 'utf8');

// Generate a TOC
toc(file);
```

## Options

All methods accept an object of options as the last argument.

### template

Type: `String`

Default: `<%= depth %><%= bullet %>[<%= heading %>](#<%= url %>)\n`

The Lo-Dash template used to generate the Table of Contents.

**Example (this is the default):**

```js
var tmpl = '<%= depth %><%= bullet %>[<%= heading %>](#<%= url %>)\n';
toc(file, {template: tmpl});
```

### bullet

Type: `String`

Default: `* `

The bullet to use for each item in the generated TOC. This is passed as a variable to the `<%= bullet %>` template.


### firsth1
<commit_msg>document maxDepth option<commit_after># marked-toc [![NPM version](https://badge.fury.io/js/marked-toc.png)](http://badge.fury.io/js/marked-toc)

> Generate a TOC (table of contents) for markdown files

_(example)_
<!-- toc -->
* [Getting Started](#getting-started)
* [Usage](#usage)
* [Options](#options)
  * [template](#template)
  * [bullet](#bullet)
  * [firsth1](#firsth1)
  * [omit](#omit)
  * [clean](#clean)
  * [blacklist](#blacklist)
  * [allowedChars](#allowedchars)
* [API](#api)
  * [toc](#toc)
  * [toc.insert](#tocinsert)
  * [toc.add](#tocadd)
  * [toc.raw](#tocraw)
* [Contributing](#contributing)
* [Author](#author)
* [License](#license)

<!-- toc stop -->

## Getting Started

Install the module with [npm](npmjs.org):

```bash
npm i marked-toc --save
```

In any markdown file, add `<!-- toc -->` where you want to add the TOC. Then in the command line, run:

```bash
toc [filename]
```

To add a TOC to your project's README.md, add `<!-- toc -->` and run:

```bash
toc
```

## Usage

```javascript
var toc = require('marked-toc');
var file = fs.readFileSync('README.md', 'utf8');

// Generate a TOC
toc(file);
```

## Options

All methods accept an object of options as the last argument.

### template

Type: `String`

Default: `<%= depth %><%= bullet %>[<%= heading %>](#<%= url %>)\n`

The Lo-Dash template used to generate the Table of Contents.

**Example (this is the default):**

```js
var tmpl = '<%= depth %><%= bullet %>[<%= heading %>](#<%= url %>)\n';
toc(file, {template: tmpl});
```

### bullet

Type: `String`

Default: `* `

The bullet to use for each item in the generated TOC. This is passed as a variable to the `<%= bullet %>` template.


### maxDepth

Type: `Number`

Default: `3`

Use headings whose depth is at most maxDepth.


### firsth1

{'fraction_non_alphanumeric': 0.21158835399250506, 'fraction_numerical': 0.0025944076102623233, 'mean_word_length': 4.125553914327917, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 31, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1904102', 'n_tokens_mistral': 1381, 'n_tokens_neox': 1215, 'n_words': 355}