Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README #116

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .verb.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Quick Start
## Quick Start
Assuming you want to add a TOC to README.md:
1. `$ npm install -g markdown-toc`
2. Edit README.md and insert the following line where you want the TOC inserted:<br />`<!-- toc -->`
2. Edit README.md and insert the following line where you want the TOC inserted:<br />`<!!-- toc -->`
3. `$ markdown-toc -i README.md`

## CLI
Expand All @@ -12,7 +12,7 @@ Usage: markdown-toc [options] <input>
input: The Markdown file to parse for table of contents,
or "-" to read from stdin.

-i: Edit the <input> file directly, injecting the TOC at <!-- toc -->;
-i: Edit the <input> file directly, injecting the TOC at <!!-- toc -->;
(Without this flag, the default is to print the TOC to stdout.)

--json: Print the TOC in JSON format
Expand Down Expand Up @@ -66,7 +66,7 @@ toc('# One\n\n# Two').content;
To allow customization of the output, an object is returned with the following properties:

- `content` **{String}**: The generated table of contents. Unless you want to customize rendering, this is all you need.
- `highest` **{Number}**: The highest level heading found. This is used to adjust indentation.
- `highest` **{Number}**: The highest level heading found. This is used to adjust indentation.
- `tokens` **{Array}**: Headings tokens that can be used for custom rendering

## API
Expand Down Expand Up @@ -102,7 +102,7 @@ Results in:

### toc.json

Object for creating a custom TOC.
Object for creating a custom TOC.

```js
toc('# AAA\n## BBB\n### CCC\nfoo').json;
Expand All @@ -116,7 +116,7 @@ toc('# AAA\n## BBB\n### CCC\nfoo').json;

### toc.insert

Insert a table of contents immediately after an _opening_ `<!!-- toc -->` code comment, or replace an existing TOC if both an _opening_ comment and a _closing_ comment (`<!!-- tocstop -->`) are found.
Insert a table of contents immediately after an _opening_ `<!!-- toc -->` code comment, or replace an existing TOC if both an _opening_ comment and a _closing_ comment (`<!!-- tocstop -->`) are found.

_(This strategy works well since code comments in markdown are hidden when viewed as HTML, like when viewing a README on GitHub README for example)._

Expand Down Expand Up @@ -160,8 +160,8 @@ var toc = require('markdown-toc');
```
- `toc.bullets()`: render a bullet list from an array of tokens
- `toc.linkify()`: linking a heading `content` string
- `toc.slugify()`: slugify a heading `content` string
- `toc.strip()`: strip words or characters from a heading `content` string
- `toc.slugify()`: slugify a heading `content` string
- `toc.strip()`: strip words or characters from a heading `content` string

**Example**

Expand Down Expand Up @@ -191,15 +191,15 @@ Type: `Function`

Default: `undefined`

Params:
Params:

- `str` **{String}** the actual heading string
- `ele` **{Objecct}** object of heading tokens
- `arr` **{Array}** all of the headings objects

**Example**

From time to time, we might get junk like this in our TOC.
From time to time, we might get junk like this in our TOC.

```
[.aaa([foo], ...) another bad heading](#-aaa--foo--------another-bad-heading)
Expand Down
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
## Table of Contents

- [Install](#install)
- [Quick Start](#quick-start)
- [CLI](#cli)
- [Highlights](#highlights)
- [Usage](#usage)
Expand Down Expand Up @@ -33,6 +34,20 @@ Install with [npm](https://www.npmjs.com/):
$ npm install --save markdown-toc
```

Install with [yarn](https://yarnpkg.com):

```sh
$ yarn add markdown-toc
```

## Quick Start

Assuming you want to add a TOC to README.md:

1. `$ npm install -g markdown-toc`
2. Edit README.md and insert the following line where you want the TOC inserted:<br />`<!-- toc -->`
3. `$ markdown-toc -i README.md`

## CLI

```
Expand All @@ -59,6 +74,9 @@ Usage: markdown-toc [options] <input>

--no-stripHeadingTags: Do not strip extraneous HTML tags from heading
text before slugifying

--indent: Provide the indentation to use - defaults to ' '
(to specify a tab, use the bash-escaped $'\t')
```

## Highlights
Expand Down Expand Up @@ -304,7 +322,10 @@ Pull requests and stars are always welcome. For bugs and feature requests, [plea
| **Commits** | **Contributor** |
| --- | --- |
| 196 | [jonschlinkert](https://github.com/jonschlinkert) |
| 9 | [doowb](https://github.com/doowb) |
| 4 | [dbooth-boston](https://github.com/dbooth-boston) |
| 4 | [stefanwalther](https://github.com/stefanwalther) |
| 3 | [sapegin](https://github.com/sapegin) |
| 3 | [Marsup](https://github.com/Marsup) |
| 2 | [dvcrn](https://github.com/dvcrn) |
| 2 | [maxogden](https://github.com/maxogden) |
Expand All @@ -319,9 +340,12 @@ Pull requests and stars are always welcome. For bugs and feature requests, [plea
| 1 | [garygreen](https://github.com/garygreen) |
| 1 | [TehShrike](https://github.com/TehShrike) |
| 1 | [citizenmatt](https://github.com/citizenmatt) |
| 1 | [mgroenhoff](https://github.com/mgroenhoff) |
| 1 | [rafaelsteil](https://github.com/rafaelsteil) |
| 1 | [RichardBradley](https://github.com/RichardBradley) |
| 1 | [sethvincent](https://github.com/sethvincent) |
| 1 | [shanehughes3](https://github.com/shanehughes3) |
| 1 | [bcho](https://github.com/bcho) |
| 1 | [lu22do](https://github.com/lu22do) |

### Building docs
Expand Down Expand Up @@ -351,9 +375,9 @@ $ npm install && npm test

### License

Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT License](LICENSE).

***

_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on September 19, 2017._
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on March 21, 2018._