Skip to content

Commit df4481f

Browse files
authored
Merge pull request #296 from rtfpessoa/add-toc
doc: Add table of contents in readme
2 parents 3be8155 + e284b58 commit df4481f

File tree

3 files changed

+218
-186
lines changed

3 files changed

+218
-186
lines changed

README.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,32 @@ diff2html generates pretty HTML diffs from git diff or unified diff output.
1818

1919
[![NPM](https://nodei.co/npm/diff2html.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/diff2html/)
2020

21+
## Table of Contents
22+
23+
<!-- toc -->
24+
25+
- [Features](#features)
26+
- [Online Example](#online-example)
27+
- [Distributions](#distributions)
28+
- [Diff2Html Usage](#diff2html-usage)
29+
- [Diff2Html API](#diff2html-api)
30+
- [Diff2Html Configuration](#diff2html-configuration)
31+
- [Diff2Html Browser](#diff2html-browser)
32+
- [Diff2Html NPM / Node.js Library](#diff2html-npm--nodejs-library)
33+
- [Diff2Html Examples](#diff2html-examples)
34+
- [Diff2HtmlUI](#diff2htmlui)
35+
- [Diff2HtmlUI API](#diff2htmlui-api)
36+
- [Diff2HtmlUI Configuration](#diff2htmlui-configuration)
37+
- [Diff2HtmlUI Browser](#diff2htmlui-browser)
38+
- [Troubleshooting](#troubleshooting)
39+
- [1. Out of memory or Slow execution](#1-out-of-memory-or-slow-execution)
40+
- [Contribute](#contribute)
41+
- [Contributors](#contributors)
42+
- [License](#license)
43+
- [Thanks](#thanks)
44+
45+
<!-- tocstop -->
46+
2147
## Features
2248

2349
- Supports git and unified diffs
@@ -379,12 +405,12 @@ document.addEventListener('DOMContentLoaded', () => {
379405

380406
- Disable the line matching algorithm, by setting the option `{"matching": "none"}` when invoking diff2html
381407

382-
## Contributions
408+
## Contribute
383409

384410
This is a developer friendly project, all the contributions are welcome. To contribute just send a pull request with
385411
your changes following the guidelines described in `CONTRIBUTING.md`. I will try to review them as soon as possible.
386412

387-
## Contributors
413+
## Contributors
388414

389415
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
390416

package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
"build:css": "rm -rf ./bundles/css; postcss --config ./postcss.config.js --no-map -o ./bundles/css/diff2html.min.css ./src/ui/css/diff2html.css",
4949
"build:templates": "ts-node ./scripts/hulk.ts --wrapper ts --variable 'defaultTemplates' ./src/templates/*.mustache > ./src/diff2html-templates.ts",
5050
"build:website": "rm -rf docs; webpack ---display-reasons --display-modules --mode production --config webpack.website.ts",
51+
"build:toc-base": "markdown-toc --maxdepth 3 --bullets='-' -i",
52+
"build:toc": "yarn run build:toc-base README.md",
5153
"test": "is-ci 'test:coverage' 'test:watch'",
5254
"test:coverage": "jest --coverage",
5355
"test:watch": "jest --watch",
@@ -78,6 +80,10 @@
7880
"**/*.+(css|html|md|mdx)": [
7981
"prettier --write",
8082
"git add"
83+
],
84+
"README.md": [
85+
"yarn run build:toc-base",
86+
"git add"
8187
]
8288
},
8389
"dependencies": {
@@ -127,6 +133,7 @@
127133
"is-ci-cli": "2.0.0",
128134
"jest": "24.9.0",
129135
"lint-staged": "9.5.0",
136+
"markdown-toc": "^1.2.0",
130137
"mini-css-extract-plugin": "0.9.0",
131138
"mkdirp": "0.5.1",
132139
"nopt": "4.0.1",

0 commit comments

Comments
 (0)