Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Specify markdown-toc as a dependency
Previously, the `entry` for the markdown-toc hook was `npx md-toc`, which was meant to call the `pre-commmit-markdown-toc` script, via the mapping in the `bin` section of `package.json`. The script then looked for the `markdown-toc` executable in the `~/.cache/pre-commit/{reponame}/node_modules/.bin/markdown-toc` directory, but would return an error because it couldn't find it. It doesn't get automatically installed there, even when specified as an additional dependency. To add to the confusion, if you had the `md-toc` package installed locally, that's what would be called instead of the `pre-commmit-markdown-toc` script, which made the error go away, but wouldn't actually generate a TOC. The solution in 3 steps: 1. Use an `entry` name that doesn't match an existing npm package. 2. Define `markdown-toc` as an additional dependency so that it gets automatically installed. 3. Instead of looking for the `markdown-toc` executable in the `pre-commit` directory, just call it directly.
- Loading branch information