Skip to content

A fast, helpful, and open-source document parser

docs: auto-generate API docs

Clelia (Astra) Bertelli95e8c706901b
diff --git a/.github/workflows/sync-docs.yml b/.github/workflows/sync-docs.yml
index 0fa479e..5ea2610 100644
--- a/.github/workflows/sync-docs.yml
+++ b/.github/workflows/sync-docs.yml
@@ -1,12 +1,10 @@
name: Sync Docs to Developer Hub
-
on:
push:
branches: [main]
paths:
- "docs/**"
workflow_dispatch:
-
jobs:
sync-docs:
runs-on: ubuntu-latest
@@ -14,8 +12,11 @@ jobs:
- name: Checkout source repo
uses: actions/checkout@v4
- - name: Install uv
- uses: astral-sh/setup-uv@v4
+ - name: Install Rust nightly
+ uses: dtolnay/rust-toolchain@nightly
+
+ - name: Install rustdoc-md
+ run: cargo install rustdoc-md
- name: Checkout docs repo
uses: actions/checkout@v4
@@ -24,25 +25,22 @@ jobs:
token: ${{ secrets.DEVELOPER_HUB_TOKEN }}
path: developer-hub
+ - name: Generate API docs
+ run: ./scripts/generate-api-docs.sh
+
- name: Sync docs
- run: |
- npm install
- npm run docs:api
- ./scripts/sync-docs-to-developer-hub.sh developer-hub
+ run: ./scripts/sync-docs-to-developer-hub.sh developer-hub
- name: Commit and push
working-directory: developer-hub
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
-
git add src/content/docs/liteparse
-
if git diff --staged --quiet; then
echo "No docs changes to sync."
exit 0
fi
-
SOURCE_SHA="${GITHUB_SHA::8}"
git commit -m "sync: liteparse docs from run-llama/liteparse@${SOURCE_SHA}"
git push
diff --git a/scripts/generate-api-docs.sh b/scripts/generate-api-docs.sh
index bfaa299..611b5ff 100755
--- a/scripts/generate-api-docs.sh
+++ b/scripts/generate-api-docs.sh
@@ -8,7 +8,11 @@ TMP_DIR="${DOCS_DIR}/.api-tmp"
OUT_FILE="${DOCS_DIR}/api.md"
# Generate markdown with TypeDoc
-npx typedoc
+mkdir -p $TMP_DIR
+cd crates/liteparse/
+cargo +nightly rustdoc --lib -- -Z unstable-options --output-format json
+cd ../../
+rustdoc-md --path ./target/doc/liteparse.json --output ${TMP_DIR}/README.md
# Prepend Starlight frontmatter to the generated README
cat > "${OUT_FILE}" <<'FRONTMATTER'