Skip to content

Commit 5bccadd

Browse files
MrBogomipsclaude
andcommitted
fix: extract API sidebar titles from H1 headings in docs workflow
The inline frontmatter loop was using filename-based titles, producing lowercase names with -N suffixes for generics. Now extracts the title from the H1 heading in each generated markdown file, matching the fix in generate-api-docs.sh. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 962954d commit 5bccadd

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

.github/workflows/docs.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,25 @@ jobs:
6464
for file in docs/docs/api/*.md; do
6565
if [ -f "$file" ]; then
6666
filename=$(basename "$file" .md)
67-
title="${filename#bogoware.monads.}"
67+
if [ "$filename" = "index" ]; then
68+
title="API Reference"
69+
position=1
70+
else
71+
position=99
72+
# Extract title from H1 heading in the generated markdown
73+
h1_line=$(grep -m1 "^# " "$file" || true)
74+
if [ -n "$h1_line" ]; then
75+
title="${h1_line#\# }"
76+
title="${title//&lt;/<}"
77+
title="${title//&gt;/>}"
78+
else
79+
title="${filename#bogoware.monads.}"
80+
fi
81+
fi
6882
temp_file=$(mktemp)
6983
echo "---" > "$temp_file"
7084
echo "title: \"$title\"" >> "$temp_file"
71-
echo "sidebar_position: 99" >> "$temp_file"
85+
echo "sidebar_position: $position" >> "$temp_file"
7286
echo "---" >> "$temp_file"
7387
echo "" >> "$temp_file"
7488
cat "$file" >> "$temp_file"

0 commit comments

Comments
 (0)