Skip to content

Commit

Permalink
Add pre-commit metadata to doctoc
Browse files Browse the repository at this point in the history
This enables doctoc to be integrated seamlessly with the following
[pre-commit](http://pre-commit.com) configuration:

```yaml
repos:
-   repo: https://github.com/thlorenz/doctoc
    sha: ...  # substitute a tag here
    hooks:
    -   doctoc
```
  • Loading branch information
asottile authored and thlorenz committed Oct 27, 2017
1 parent 9113184 commit e0831d3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- id: doctoc
name: doctoc
language: node
entry: doctoc
types: [markdown]
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ by github or other sites via a command line flag.
- [Specifying a custom TOC title](#specifying-a-custom-toc-title)
- [Specifying a maximum heading level for TOC entries](#specifying-a-maximum-heading-level-for-toc-entries)
- [Printing to stdout](#printing-to-stdout)
- [Usage as a `git` hook](#usage-as-a-git-hook)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

Expand Down Expand Up @@ -138,3 +139,19 @@ By default,
You can print to stdout by using the `-s` or `--stdout` option.

[ack]: http://beyondgrep.com/

### Usage as a `git` hook

doctoc can be used as a [pre-commit](http://pre-commit.com) hook by using the
following configuration:

```yaml
repos:
- repo: https://github.com/thlorenz/doctoc
sha: ... # substitute a tagged version
hooks:
- id: doctoc
```
This will run `doctoc` against markdown files when committing to ensure the
TOC stays up-to-date.

0 comments on commit e0831d3

Please sign in to comment.