Add markdown TOC generation using pandoc and shell
See a875763ecc/lib/misc.sh (L28)
The TOC is generated via pandoc and inserted via shell. `<!-- toc -->`
marks the insertion point, the TOC is inserted right below.
I'm using this in utils-go too. We should use it anywhere else we need
TOCs. I'm sure pandoc can handle the frontmatter in d2-docs too.
This commit is contained in:
parent
0cb71095b7
commit
b81647e7e3
3 changed files with 26 additions and 22 deletions
2
Makefile
2
Makefile
|
|
@ -5,7 +5,7 @@ all: fmt gen lint build test
|
|||
|
||||
.PHONY: fmt
|
||||
fmt:
|
||||
prefix "$@" ./ci/sub/fmt/make.sh
|
||||
prefix "$@" ./ci/fmt.sh
|
||||
.PHONY: gen
|
||||
gen:
|
||||
prefix "$@" ./ci/gen.sh
|
||||
|
|
|
|||
39
README.md
39
README.md
|
|
@ -19,27 +19,24 @@
|
|||
# Table of Contents
|
||||
|
||||
<!-- toc -->
|
||||
|
||||
- [What does D2 look like?](#what-does-d2-look-like)
|
||||
- [Quickstart](#quickstart)
|
||||
- [Install](#install)
|
||||
- [D2 as a library](#d2-as-a-library)
|
||||
- [Themes](#themes)
|
||||
- [Fonts](#fonts)
|
||||
- [Export file types](#export-file-types)
|
||||
- [Language tooling](#language-tooling)
|
||||
- [Plugins](#plugins)
|
||||
- [Comparison](#comparison)
|
||||
- [Contributing](#contributing)
|
||||
- [License](#license)
|
||||
- [Related](#related)
|
||||
* [VSCode extension](#vscode-extension)
|
||||
* [Vim extension](#vim-extension)
|
||||
* [Language docs](#language-docs)
|
||||
* [Misc](#misc)
|
||||
- [FAQ](#faq)
|
||||
|
||||
<!-- tocstop -->
|
||||
- <a href="#what-does-d2-look-like" id="toc-what-does-d2-look-like">What does D2 look like?</a>
|
||||
- <a href="#quickstart" id="toc-quickstart">Quickstart</a>
|
||||
- <a href="#install" id="toc-install">Install</a>
|
||||
- <a href="#d2-as-a-library" id="toc-d2-as-a-library">D2 as a library</a>
|
||||
- <a href="#themes" id="toc-themes">Themes</a>
|
||||
- <a href="#fonts" id="toc-fonts">Fonts</a>
|
||||
- <a href="#export-file-types" id="toc-export-file-types">Export file types</a>
|
||||
- <a href="#language-tooling" id="toc-language-tooling">Language tooling</a>
|
||||
- <a href="#plugins" id="toc-plugins">Plugins</a>
|
||||
- <a href="#comparison" id="toc-comparison">Comparison</a>
|
||||
- <a href="#contributing" id="toc-contributing">Contributing</a>
|
||||
- <a href="#license" id="toc-license">License</a>
|
||||
- <a href="#related" id="toc-related">Related</a>
|
||||
- <a href="#vscode-extension" id="toc-vscode-extension">VSCode extension</a>
|
||||
- <a href="#vim-extension" id="toc-vim-extension">Vim extension</a>
|
||||
- <a href="#language-docs" id="toc-language-docs">Language docs</a>
|
||||
- <a href="#misc" id="toc-misc">Misc</a>
|
||||
- <a href="#faq" id="toc-faq">FAQ</a>
|
||||
|
||||
## What does D2 look like?
|
||||
|
||||
|
|
|
|||
7
ci/fmt.sh
Executable file
7
ci/fmt.sh
Executable file
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
. "$(dirname "$0")/sub/lib.sh"
|
||||
cd -- "$(dirname "$0")/.."
|
||||
|
||||
sh_c tocsubst --skip 1 README.md
|
||||
./ci/sub/fmt/make.sh
|
||||
Loading…
Reference in a new issue