mirror of
https://github.com/holos-run/holos.git
synced 2026-03-21 01:35:02 +00:00
Switch holos to use v1alpha3 so we can establish more of the CUE structures in the documented API using Go structs.
18 lines
677 B
Bash
Executable File
18 lines
677 B
Bash
Executable File
#! /bin/bash
|
|
#
|
|
set -euo pipefail
|
|
|
|
# Generate the documentation for the package the calls go:generate
|
|
package="$(git rev-parse --show-prefix)"
|
|
cd "$(git rev-parse --show-toplevel)"
|
|
mkdir -p "doc/md/$(dirname "${package}")"
|
|
gomarkdoc --output "doc/md/${package%/}.md" "./${package}"
|
|
|
|
# Fix heading anchors by making them explicit
|
|
# Refer to https://docusaurus.io/docs/markdown-features/toc#heading-ids
|
|
stamp=$RANDOM
|
|
# sed 's/^## type /## /' "doc/md/${package%/}.md" > "doc/md/${package%/}.md.${stamp}"
|
|
|
|
sed -E 's/## type ([A-Za-z0-9_]+)/## type \1 {#\1}/' "doc/md/${package%/}.md" > "doc/md/${package%/}.md.${stamp}"
|
|
mv "doc/md/${package%/}.md.${stamp}" "doc/md/${package%/}.md"
|