-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Related GH-28. Closes GH-29. Reviewed-by: Christian Murphy <[email protected]> Reviewed-by: Junyoung Choi <[email protected]> Reviewed-by: Titus Wormer <[email protected]>
- Loading branch information
1 parent
2385f87
commit 635ad84
Showing
6 changed files
with
68 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,14 +28,18 @@ | |
"Jonathan Haines <[email protected]>", | ||
"Robin Millette <[email protected]>" | ||
], | ||
"types": "types/index.d.ts", | ||
"files": [ | ||
"types/index.d.ts", | ||
"index.js" | ||
], | ||
"dependencies": { | ||
"mdast-util-toc": "^4.0.0" | ||
"@types/unist": "^2.0.3", | ||
"mdast-util-toc": "^5.0.0" | ||
}, | ||
"devDependencies": { | ||
"browserify": "^16.0.0", | ||
"dtslint": "^2.0.0", | ||
"is-hidden": "^1.1.0", | ||
"negate": "^1.0.0", | ||
"nyc": "^14.0.0", | ||
|
@@ -45,7 +49,7 @@ | |
"remark-preset-wooorm": "^6.0.0", | ||
"tape": "^4.0.0", | ||
"tinyify": "^2.0.0", | ||
"xo": "^0.24.0" | ||
"xo": "^0.25.0" | ||
}, | ||
"scripts": { | ||
"format": "remark *.md -qfo && prettier --write \"**/*.js\" && xo --fix", | ||
|
@@ -54,7 +58,8 @@ | |
"build": "npm run build-bundle && npm run build-mangle", | ||
"test-api": "node test", | ||
"test-coverage": "nyc --reporter lcov tape test/index.js", | ||
"test": "npm run format && npm run build && npm run test-coverage" | ||
"test-types": "dtslint types", | ||
"test": "npm run format && npm run build && npm run test-coverage && npm run test-types" | ||
}, | ||
"prettier": { | ||
"tabWidth": 2, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Minimum TypeScript Version: 3.2 | ||
|
||
import {Node} from 'unist' | ||
import {TOCOptions} from 'mdast-util-toc' | ||
|
||
declare namespace remarkToc { | ||
type TOCSettings = Pick<TOCOptions, 'heading' | 'maxDepth' | 'tight' | 'skip'>; | ||
} | ||
|
||
/** | ||
* Generate a Table of Contents. | ||
* | ||
* @param settings configuration for generating the table of contents | ||
*/ | ||
declare function remarkToc( | ||
settings?: remarkToc.TOCSettings | ||
): (node: Node) => void | ||
|
||
export = remarkToc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import remark = require('remark') | ||
|
||
import toc = require('remark-toc') | ||
|
||
remark().use(toc) | ||
|
||
remark().use(toc, {}) | ||
|
||
remark().use(toc, { | ||
heading: 'heading' | ||
}) | ||
|
||
remark().use(toc, { | ||
maxDepth: 2 | ||
}) | ||
|
||
remark().use(toc, { | ||
tight: true | ||
}) | ||
|
||
remark().use(toc, { | ||
skip: 'skip-heading' | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"compilerOptions": { | ||
"lib": ["es2015"], | ||
"strict": true, | ||
"baseUrl": ".", | ||
"paths": { | ||
"remark-toc": ["index.d.ts"] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"extends": "dtslint/dtslint.json", | ||
"rules": { | ||
"semicolon": false, | ||
"whitespace": false | ||
} | ||
} |