Skip to content

Commit a5b455f

Browse files
authored
pre-commit: auto add table of contents with doctoc (#11679)
https://github.com/thlorenz/doctoc?tab=readme-ov-file#usage-as-a-git-hook https://github.com/thlorenz/doctoc/releases/tag/v2.2.0 Generates table of contents for Markdown files inside local git repository. Links are compatible with anchors generated by github or other sites. Added TOC to 3 Markdown files. Never have to create a TOC again just run: `pre-commit run doctoc --all-files` - CONTRIBUTING.md - INSTALL.md - README.md So both Apache Airflow and Apache Sedona use `doctoc`: https://github.com/apache/airflow/blob/eb4a8bc03c92d84e8238dcd76becb267ec8c3dd5/.pre-commit-config.yaml#L32 https://github.com/apache/sedona/blob/b0d86fda010e42f30b090aef1b2dbf06aa0a19d2/.pre-commit-config.yaml#L34
1 parent 8b034dc commit a5b455f

File tree

4 files changed

+62
-11
lines changed

4 files changed

+62
-11
lines changed

.pre-commit-config.yaml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ repos:
2525
hooks:
2626
- id: identity
2727
- id: check-hooks-apply
28+
- repo: https://github.com/thlorenz/doctoc.git
29+
rev: v2.2.0
30+
hooks:
31+
- id: doctoc
32+
name: Add TOC for Markdown files
33+
files: ^CONTRIBUTING\.md$|^INSTALL\.md$|^README\.md$
2834
- repo: https://github.com/oxipng/oxipng
2935
rev: v9.1.5
3036
hooks:
@@ -41,6 +47,11 @@ repos:
4147
- repo: https://github.com/Lucas-C/pre-commit-hooks
4248
rev: v1.5.5
4349
hooks:
50+
- id: chmod
51+
name: set file permissions
52+
args: ['644']
53+
files: \.md$
54+
stages: [manual]
4455
- id: insert-license
4556
name: add license for all Markdown files
4657
files: \.md$
@@ -117,14 +128,6 @@ repos:
117128
args: [--config=.github/linters/.markdown-lint.yml]
118129
types: [markdown]
119130
files: \.(md|mdown|markdown)$
120-
- repo: https://github.com/Lucas-C/pre-commit-hooks
121-
rev: v1.5.5
122-
hooks:
123-
- id: chmod
124-
name: set file permissions
125-
args: ['644']
126-
files: \.md$
127-
stages: [manual]
128131
- repo: https://github.com/adrienverge/yamllint
129132
rev: v1.37.1
130133
hooks:

CONTRIBUTING.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,24 @@
2121

2222
## Summary
2323

24+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
25+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
26+
27+
- [Summary](#summary)
28+
- [Bug fixes](#bug-fixes)
29+
- [Developing new features](#developing-new-features)
30+
- [PendingReleaseNotes file](#pendingreleasenotes-file)
31+
- [Fork the code](#fork-the-code)
32+
- [Making changes](#making-changes)
33+
- [Rebase `feature_x` to include updates from `upstream/main`](#rebase-feature_x-to-include-updates-from-upstreammain)
34+
- [Make a GitHub Pull Request to contribute your changes](#make-a-github-pull-request-to-contribute-your-changes)
35+
- [Cleaning up after a successful pull request](#cleaning-up-after-a-successful-pull-request)
36+
- [Release Principles](#release-principles)
37+
38+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
39+
40+
## Summary
41+
2442
This document covers how to contribute to the ACS project. ACS uses GitHub PRs to manage code contributions.
2543
These instructions assume you have a GitHub.com account, so if you don't have one you will have to create one. Your proposed code changes will be published to your own fork of the ACS project, and you will submit a Pull Request for your changes to be added.
2644

INSTALL.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,21 @@ or the developer [wiki](https://cwiki.apache.org/confluence/display/CLOUDSTACK/H
2626
Apache CloudStack developers use various platforms for development, this guide
2727
was tested against a CentOS 7 x86_64 setup.
2828

29-
* [Setting up development environment](https://cwiki.apache.org/confluence/display/CLOUDSTACK/Setting+up+CloudStack+Development+Environment) for Apache CloudStack.
30-
* [Building](https://cwiki.apache.org/confluence/display/CLOUDSTACK/How+to+build+CloudStack) Apache CloudStack.
31-
* [Appliance based development](https://github.com/rhtyd/monkeybox)
29+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
30+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
31+
32+
- [Setting up Development Environment](#setting-up-development-environment)
33+
- [Using jenv and/or pyenv for Version Management](#using-jenv-andor-pyenv-for-version-management)
34+
- [Getting the Source Code](#getting-the-source-code)
35+
- [Building](#building)
36+
- [To bring up CloudStack UI](#to-bring-up-cloudstack-ui)
37+
- [Building with non-redistributable plugins](#building-with-non-redistributable-plugins)
38+
- [Packaging and Installation](#packaging-and-installation)
39+
- [Debian/Ubuntu](#debianubuntu)
40+
- [RHEL/CentOS](#rhelcentos)
41+
- [Notes](#notes)
42+
43+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
3244

3345
## Setting up Development Environment
3446

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,24 @@
3131

3232
[![Apache CloudStack](tools/logo/apache_cloudstack.png)](https://cloudstack.apache.org/)
3333

34+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
35+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
36+
37+
- [Who Uses CloudStack?](#who-uses-cloudstack)
38+
- [Demo](#demo)
39+
- [Getting Started](#getting-started)
40+
- [Getting Source Repository](#getting-source-repository)
41+
- [Documentation](#documentation)
42+
- [News and Events](#news-and-events)
43+
- [Getting Involved and Contributing](#getting-involved-and-contributing)
44+
- [Reporting Security Vulnerabilities](#reporting-security-vulnerabilities)
45+
- [License](#license)
46+
- [Notice of Cryptographic Software](#notice-of-cryptographic-software)
47+
- [Star History](#star-history)
48+
- [Contributors](#contributors)
49+
50+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
51+
3452
Apache CloudStack is open source software designed to deploy and manage large
3553
networks of virtual machines, as a highly available, highly scalable
3654
Infrastructure as a Service (IaaS) cloud computing platform. CloudStack is used

0 commit comments

Comments
 (0)