Pre-commit hook#
This repo provides the following plugin
to be used with the Pre-commit framework
---
# Define plugins (hooks) provided by this repo.
# How to test: https://pre-commit.com/#developing-hooks-interactively
- id: md-toc
name: Update markdown table of contents
description: 'Automatically generate and add a table of contents to markdown files'
language: python
types: [markdown] # as detected by pre-commit with identify-cli
entry: md_toc
args: [-p, github]
Add a .pre-commit-config.yaml
file in the root of your GIT repo.
Have a look at the /.pre-commit-hooks.yaml
file of this repository for a
full example.
These are the default plugin settings
repos:
- repo: https://codeberg.org/frnmst/md-toc
# Release updates (ATOM) https://codeberg.org/frnmst/md-toc/tags.atom
rev: master # set a GIT tag
hooks:
- id: md-toc
You can override the defaults via the args
parameter, such as
repos:
- repo: https://codeberg.org/frnmst/md-toc
# Release updates (ATOM) https://codeberg.org/frnmst/md-toc/tags.atom
rev: master # set a GIT tag
hooks:
- id: md-toc
args: [-p, --skip-lines, '1', redcarpet] # CLI options
Finally, run pre-commit install
to enable the hook.