Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mihaeu/md-toc-generator
Creates and updates tables of content in your markdown files.
https://github.com/mihaeu/md-toc-generator
Last synced: 1 day ago
JSON representation
Creates and updates tables of content in your markdown files.
- Host: GitHub
- URL: https://github.com/mihaeu/md-toc-generator
- Owner: mihaeu
- License: mit
- Created: 2021-09-24T14:59:18.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-09-27T06:50:23.000Z (about 3 years ago)
- Last Synced: 2024-10-20T08:32:32.537Z (24 days ago)
- Language: JavaScript
- Size: 66.4 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# md-toc-generator
> Creates and updates tables of content in your markdown files.
[//]: # "BEGIN_TOC"
1. [Usage](#usage)
1. [License](#license)[//]: # "END_TOC"
## Usage
Install the package globally or as a local dependency:
```bash
# npm install md-toc-generator
# npm install --global md-toc-generator
# yarn global add md-toc-generator
yarn add md-toc-generator
```Add a placeholder to files that you want to create ToC for:
```md
[//]: # "BEGIN_TOC"
[//]: # "END_TOC"
```Then call the script:
```bash
# adds/updates ToC README.md in current directory
md-toc-generator# adds/updates ToC wherever you point it to
md-toc-generator --paths
```If you want to lint your markdown files to see if the ToC is up to date, but without changing anything, use the `--ci` flag (example usage in the [GitHub actions](https://github.com/mihaeu/md-toc-generator/actions) of this project).
```bash
md-toc-generator --ci
```If you want to ensure that given markdown files have a toc, use the `--placeholder-required` option.
## License
See [`LICENSE`](LICENSE) file.