Pre-commit hook

This repo provides the following plugin for use with the Pre-commit framework:

The .pre-commit-hooks.yaml file
---
# 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: 'Replace TOC marker with a table of contents'
  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. These are the default plugin settings:

A simple example of a .pre-commit-config.yaml file
 repos:
 -   repo: https://codeberg.org/frnmst/md-toc
     rev: master  # or a specific git tag from md-toc
     hooks:
     -   id: md-toc

You can override the defaults via the args parameter, such as:

Example of arguments passed as a pre-commit
 repos:
 -   repo: https://codeberg.org/frnmst/md-toc
     rev: master  # or a specific git tag from md-toc
     hooks:
     -   id: md-toc
         args: [-p, --skip-lines, '1', redcarpet]  # CLI options

This is what I use in some repositories:

# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
-   repo: https://codeberg.org/pre-commit/pre-commit-hooks
    rev: v2.4.0
    hooks:
    -   id: trailing-whitespace
    -   id: end-of-file-fixer
    -   id: check-yaml
    -   id: check-added-large-files

-  repo: https://codeberg.org/frnmst/md-toc
   rev: 'master'  # or a specific git tag from md-toc
   hooks:
   -    id: md-toc
        args: [-p, 'github', '-l6']  # CLI options

Finally run $ pre-commit install to enable the hook.