markdown-toc
Advanced tools
Comparing version 0.11.2 to 0.11.3
@@ -190,3 +190,3 @@ /*! | ||
if (opts && typeof opts.linkify === 'function') { | ||
return opts.linkify(ele, slug, opts); | ||
return opts.linkify(ele, text, slug, opts); | ||
} | ||
@@ -193,0 +193,0 @@ ele.content = mdlink(text, '#' + slug); |
{ | ||
"name": "markdown-toc", | ||
"description": "Generate a markdown TOC (table of contents) with Remarkable.", | ||
"version": "0.11.2", | ||
"version": "0.11.3", | ||
"homepage": "https://github.com/jonschlinkert/markdown-toc", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -5,7 +5,7 @@ # markdown-toc [![NPM version](https://badge.fury.io/js/markdown-toc.svg)](http://badge.fury.io/js/markdown-toc) [![Build Status](https://travis-ci.org/jonschlinkert/markdown-toc.svg)](https://travis-ci.org/jonschlinkert/markdown-toc) | ||
- Won't mangle markdown in code examples (like headings in gfm fenced code blocks that other TOC generators mistake as being real headings) | ||
- Uses sane defaults, so no customization is necessary, but you can if you need to. | ||
- Get JSON to generate your own TOC from whatever templates you want to use | ||
- [filter](#filter-headings) out headings you don't want | ||
- [Improve](#titleize) the headings you do want | ||
* Won't mangle markdown in code examples (like headings in gfm fenced code blocks that other TOC generators mistake as being real headings) | ||
* Uses sane defaults, so no customization is necessary, but you can if you need to. | ||
* Get JSON to generate your own TOC from whatever templates you want to use | ||
* [filter](#filter-headings) out headings you don't want | ||
* [Improve](#titleize) the headings you do want | ||
@@ -19,6 +19,8 @@ ## Install with [npm](npmjs.org) | ||
## Related projects | ||
* [gfm-code-blocks](https://github.com/jonschlinkert/gfm-code-blocks): Extract gfm (GitHub Flavored Markdown) fenced code blocks from a… [more](https://github.com/jonschlinkert/gfm-code-blocks) | ||
* [gfm-code-blocks](https://github.com/jonschlinkert/gfm-code-blocks): Extract gfm (GitHub Flavored Markdown) fenced code blocks from a string. | ||
* [markdown-utils](https://github.com/jonschlinkert/markdown-utils): Micro-utils for creating markdown snippets. | ||
* [markdown-link](https://github.com/jonschlinkert/markdown-link): Micro util for generating a single markdown link. | ||
* [markdown-utils](https://github.com/jonschlinkert/markdown-utils): Micro-utils for creating markdown snippets. | ||
* [remarkable](https://github.com/jonschlinkert/remarkable): Markdown parser, done right. 100% Commonmark support, extensions, syntax plugins,… [more](https://github.com/jonschlinkert/remarkable) | ||
* [pretty-remarkable](https://github.com/jonschlinkert/pretty-remarkable): Plugin for prettifying markdown with Remarkable using custom renderer rules. | ||
* [remarkable](https://github.com/jonschlinkert/remarkable): Markdown parser, done right. 100% Commonmark support, extensions, syntax plugins, high speed - all in… [more](https://github.com/jonschlinkert/remarkable) | ||
@@ -38,7 +40,6 @@ ## Usage | ||
- `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. | ||
- `tokens` **{Array}**: Headings tokens that can be used for custom rendering | ||
* `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. | ||
* `tokens` **{Array}**: Headings tokens that can be used for custom rendering | ||
## API | ||
@@ -48,3 +49,3 @@ | ||
Object for creating a custom TOC. | ||
Object for creating a custom TOC. | ||
@@ -60,6 +61,5 @@ ```js | ||
### 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. | ||
@@ -106,7 +106,8 @@ _(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)._ | ||
``` | ||
- `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.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 | ||
**Example** | ||
@@ -133,3 +134,2 @@ | ||
### options.filter | ||
@@ -141,11 +141,11 @@ | ||
Params: | ||
Params: | ||
- `str` **{String}** the actual heading string | ||
- `ele` **{Objecct}** object of heading tokens | ||
- `arr` **{Array}** all of the headings objects | ||
* `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. | ||
@@ -170,3 +170,2 @@ ```markdown | ||
### options.bullets | ||
@@ -180,3 +179,2 @@ | ||
### options.maxDepth | ||
@@ -190,3 +188,2 @@ | ||
### options.firsth1 | ||
@@ -200,4 +197,4 @@ | ||
## Running tests | ||
## Running tests | ||
Install dev dependencies: | ||
@@ -210,5 +207,7 @@ | ||
## Contributing | ||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/markdown-toc/issues) | ||
## Author | ||
**Jon Schlinkert** | ||
@@ -220,7 +219,14 @@ | ||
## License | ||
Copyright (c) 2014-2015 Jon Schlinkert | ||
Released under the MIT license | ||
Copyright (c) 2014-2015 Jon Schlinkert | ||
Released under the MIT license. | ||
*** | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on April 23, 2015._ | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on April 27, 2015._ | ||
<!-- reflinks generated by verb-reflinks plugin --> | ||
[assemble]: http://assemble.io | ||
[template]: https://github.com/jonschlinkert/template | ||
[verb]: https://github.com/assemble/verb |
15654
218