diff --git a/.verb.md b/.verb.md index bdd7611..beaa470 100644 --- a/.verb.md +++ b/.verb.md @@ -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:
`` +2. Edit README.md and insert the following line where you want the TOC inserted:
`` 3. `$ markdown-toc -i README.md` ## CLI @@ -12,7 +12,7 @@ Usage: markdown-toc [options] input: The Markdown file to parse for table of contents, or "-" to read from stdin. - -i: Edit the file directly, injecting the TOC at ; + -i: Edit the file directly, injecting the TOC at ; (Without this flag, the default is to print the TOC to stdout.) --json: Print the TOC in JSON format @@ -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 @@ -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; @@ -116,7 +116,7 @@ toc('# AAA\n## BBB\n### CCC\nfoo').json; ### toc.insert -Insert a table of contents immediately after an _opening_ `` code comment, or replace an existing TOC if both an _opening_ comment and a _closing_ comment (``) are found. +Insert a table of contents immediately after an _opening_ `` code comment, or replace an existing TOC if both an _opening_ comment and a _closing_ comment (``) 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)._ @@ -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** @@ -191,7 +191,7 @@ Type: `Function` Default: `undefined` -Params: +Params: - `str` **{String}** the actual heading string - `ele` **{Objecct}** object of heading tokens @@ -199,7 +199,7 @@ Params: **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) diff --git a/README.md b/README.md index b8766c4..ebfcace 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ ## Table of Contents - [Install](#install) +- [Quick Start](#quick-start) - [CLI](#cli) - [Highlights](#highlights) - [Usage](#usage) @@ -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:
`` +3. `$ markdown-toc -i README.md` + ## CLI ``` @@ -59,6 +74,9 @@ Usage: markdown-toc [options] --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 @@ -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) | @@ -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 @@ -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._ \ No newline at end of file +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on March 21, 2018._ \ No newline at end of file