Skip to content

Commit 7dd715f

Browse files
committed
refactor: make markdown generation idiomatic
- Re-namespace the markdown generation task, from `docs:markdown`, to `docs:generate:markdown`, so it's clearer what it's doing. This could be folded into the `docs:generate` task as an option, but we can tackle that separately if we find it's more ergonomic. - Call `docs:generate` if the XML doesn't yet exist, instead of nagging the user to do it. Make the computer do the work, not the user. - Hide xml-to-markdown.py from `mise tasks` output, because it's internal implementation that users shouldn't be calling directly. - Ensure Python is installed, so xml-to-markdown.py works out of the box
1 parent 6bb1bc1 commit 7dd715f

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

mise.toml

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"rust" = { version = "latest", components = "rustc,rust-std,cargo,rustfmt,rust-docs,clippy" }
1212
"cargo:cargo-binstall" = "latest"
1313
"cargo:sqlx-cli" = "latest"
14-
14+
"python" = "latest"
1515

1616
[task_config]
1717
includes = ["tasks", "tasks/postgres.toml"]
@@ -55,21 +55,3 @@ dir = "{{config_root}}/tests/sqlx"
5555
run = """
5656
cargo watch -x test
5757
"""
58-
59-
[tasks."docs:markdown"]
60-
description = "Generate Markdown from XML documentation"
61-
run = """
62-
echo "Converting XML to Markdown..."
63-
64-
# Ensure XML exists
65-
if [ ! -d "docs/api/xml" ]; then
66-
echo "Error: XML documentation not found. Run 'mise run docs:generate' first."
67-
exit 1
68-
fi
69-
70-
# Run converter
71-
python3 tasks/xml-to-markdown.py docs/api/xml docs/api/markdown
72-
73-
echo ""
74-
echo "✓ Markdown documentation: docs/api/markdown/API.md"
75-
"""

tasks/docs/generate/markdown.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
#MISE description="Generate Markdown from XML documentation"
3+
4+
echo "Converting XML to Markdown..."
5+
6+
# Ensure XML exists
7+
if [ ! -d "docs/api/xml" ]; then
8+
echo "warning: XML documentation not found"
9+
echo "Generating XML documentation..."
10+
mise run --output prefix docs:generate
11+
fi
12+
13+
# Run converter
14+
mise run --output prefix docs:generate:xml-to-markdown docs/api/xml docs/api/markdown
15+
16+
echo ""
17+
echo "✓ Markdown documentation: docs/api/markdown/API.md"

tasks/xml-to-markdown.py renamed to tasks/docs/generate/xml-to-markdown.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env python3
2+
#MISE hide=true
23
"""
34
Simple Doxygen XML to Markdown converter for SQL function documentation.
45

0 commit comments

Comments
 (0)