Skip to content

Commit 5789a2f

Browse files
committed
Add pre-commit hook doctoc to auto generate README table of contents
thlorenz/doctoc@59dcae9 Adds some more automation to auto create the table of contents. https://github.com/thlorenz/doctoc https://github.com/thlorenz/doctoc#usage-as-a-git-hook Used on Apache Airflow: https://github.com/apache/airflow/blob/be44ad1ac6c3b368187b73542ae06e1339ffa8fc/.pre-commit-config.yaml#L33 Also used on Apache CloudStack: https://github.com/apache/cloudstack/blob/5ad7daf6100bed5fd8d90c4e186447d549a3cd68/.pre-commit-config.yaml#L28 We can change the placement of the TOC or add some text before if needed. There are options for further formatting including only showing certain heading levels: https://github.com/thlorenz/doctoc#source-options
1 parent 0a16c76 commit 5789a2f

2 files changed

Lines changed: 51 additions & 0 deletions

File tree

.pre-commit-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ repos:
3131
- id: check-hooks-apply
3232
name: run check hooks apply
3333
description: check that all the hooks apply to the repository
34+
- repo: https://github.com/thlorenz/doctoc.git
35+
rev: 59dcae910a6ad4bbe8711275b854e3cd5c30f08b # frozen: v2.5.0
36+
hooks:
37+
- id: doctoc
38+
name: add TOC for Markdown files
39+
description: automatically keeps your table of contents up to date
40+
files: ^README\.md$
3441
- repo: https://github.com/codespell-project/codespell
3542
rev: 2ccb47ff45ad361a21071a7eedda4c37e6ae8c5a # frozen: v2.4.2
3643
hooks:

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,50 @@
44
[![Azure DevOps builds (master)](https://img.shields.io/azure-devops/build/lucene-net/6ba240c9-9598-47e7-a793-0ed8a4ba2f8b/3/master)](https://dev.azure.com/lucene-net/Lucene.NET/_build?definitionId=3&_a=summary)
55
[![GitHub](https://img.shields.io/github/license/apache/lucenenet)](https://github.com/apache/lucenenet/blob/master/LICENSE.txt)
66

7+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
8+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
9+
10+
- [Powerful Full-text search for .NET](#powerful-full-text-search-for-net)
11+
- [Supported Frameworks](#supported-frameworks)
12+
- [Lucene.NET 3.0.3](#lucenenet-303)
13+
- [Lucene.NET 4.8.0](#lucenenet-480)
14+
- [Status](#status)
15+
- [Download](#download)
16+
- [Lucene.NET 3.0.3](#lucenenet-303-1)
17+
- [Core Library](#core-library)
18+
- [All Packages](#all-packages)
19+
- [Lucene.NET 4.8.0](#lucenenet-480-1)
20+
- [Core Library](#core-library-1)
21+
- [All Packages](#all-packages-1)
22+
- [Documentation](#documentation)
23+
- [Legacy Versions](#legacy-versions)
24+
- [Demos & Tools](#demos--tools)
25+
- [How to Contribute](#how-to-contribute)
26+
- [Join Mailing Lists](#join-mailing-lists)
27+
- [Ask a Question](#ask-a-question)
28+
- [Report a Bug](#report-a-bug)
29+
- [Start a Discussion](#start-a-discussion)
30+
- [Submit a Pull Request](#submit-a-pull-request)
31+
- [Building and Testing](#building-and-testing)
32+
- [Command Line](#command-line)
33+
- [Prerequisites](#prerequisites)
34+
- [Execution](#execution)
35+
- [Windows](#windows)
36+
- [Linux or macOS](#linux-or-macos)
37+
- [Build Options](#build-options)
38+
- [Windows](#windows-1)
39+
- [Linux or macOS](#linux-or-macos-1)
40+
- [Visual Studio](#visual-studio)
41+
- [Prerequisites](#prerequisites-1)
42+
- [Execution](#execution-1)
43+
- [Azure DevOps](#azure-devops)
44+
- [Prerequisites](#prerequisites-2)
45+
- [Execution](#execution-2)
46+
- [If you don't already have a pipeline set up:](#if-you-dont-already-have-a-pipeline-set-up)
47+
- [If you already have a pipeline set up:](#if-you-already-have-a-pipeline-set-up)
48+
49+
<!-- END doctoc -->
50+
751
## Powerful Full-text search for .NET
852

953
Apache Lucene.NET is an open-source full-text search library written in C#. It is a port of the popular Java Apache Lucene project.

0 commit comments

Comments
 (0)