mirror of
https://github.com/luongnv89/claude-howto.git
synced 2026-12-03 02:03:31 +01:00
* refactor(website): render diagrams with pinned pele bundle (#195) * refactor(ci): validate diagrams with pele and fail when missing (#195) * refactor(epub): render diagrams as flattened pele svg (#195) * docs: document pele diagram rendering and node 20 setup (#195) * test(epub): assert numbered labels reach pele unescaped (#195) * fix(scripts): address review feedback (#195) * fix(website): keep pele zoom controls off diagram labels (#195) Pele (zoom: 'auto') draws an opaque zoom box over the top-right corner of every diagram it shrinks to fit, which hid labels. When that box is shown, div.mermaid now gets top padding so the diagram starts below it. Top room rather than side room: Pele lays diagrams out to the content width, so side padding would shrink them further and re-lay them out. Zoom also makes each shrunk diagram a tab stop, but the SVG had no accessible name. Name every SVG Pele draws after the nearest heading plus its diagram kind ("Architecture - flowchart"). Pele draws a new <svg> on resize and font load, so the name is set in onRender. SVGs named by accTitle keep their own name. * fix(scripts): load the cached pele bundle as ESM on node 20 (#195) pele_render.mjs imports Pele's ES module build, dist/pele.js, which was cached as a bare pele.js with no package.json "type": "module" beside it. Node.js 20.0-20.18 and 22.0-22.6 have no ESM syntax detection, so they load that file as CommonJS and crash on `export`, failing check_mermaid.py and build_epub.py on a supported Node. Cache dist/pele.js as pele.mjs (the same sha256-pinned file) and hand that path to the helper, so every Node.js >= 20 loads it as an ES module. A cache holding only pele.js downloads and verifies pele.mjs once. A test turns off syntax detection to reproduce the old Node behaviour on newer Node.
134 lines
3.6 KiB
YAML
134 lines
3.6 KiB
YAML
name: Documentation Checks
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- '**.md'
|
|
- '.github/workflows/docs-check.yml'
|
|
- '.github/markdown-link-check-config.json'
|
|
- '.markdownlint.json'
|
|
- 'scripts/check_*.py'
|
|
- 'scripts/vendor_assets.py'
|
|
- 'scripts/pele_renderer.py'
|
|
- 'scripts/pele_render.mjs'
|
|
pull_request:
|
|
branches: [main]
|
|
paths:
|
|
- '**.md'
|
|
- 'CONTRIBUTING.md'
|
|
- 'LICENSE'
|
|
- '.github/workflows/docs-check.yml'
|
|
- '.github/markdown-link-check-config.json'
|
|
- '.markdownlint.json'
|
|
- 'scripts/check_*.py'
|
|
- 'scripts/vendor_assets.py'
|
|
- 'scripts/pele_renderer.py'
|
|
- 'scripts/pele_render.mjs'
|
|
|
|
# Cancel in-progress runs for the same branch
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
markdown-lint:
|
|
name: Markdown Linting
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '18'
|
|
|
|
- name: Install markdownlint-cli
|
|
run: npm install -g markdownlint-cli
|
|
|
|
- name: Run Markdown Linter
|
|
run: markdownlint '**/*.md' --ignore node_modules --ignore .venv --config .markdownlint.json
|
|
|
|
link-check:
|
|
name: Check Links
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Run link check
|
|
run: python scripts/check_links.py
|
|
env:
|
|
LINK_CHECK_STRICT: "1"
|
|
|
|
mermaid:
|
|
name: Mermaid Syntax (Pele)
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
# Pele needs Node.js >= 20; the pinned bundle is downloaded once and
|
|
# sha256-verified on every run (see scripts/vendor_assets.py).
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
|
|
- name: Setup Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Cache Pele bundle
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: scripts/.vendor-cache/pele
|
|
key: pele-${{ hashFiles('scripts/vendor_assets.py') }}
|
|
|
|
# Strict: fails if Pele cannot run or no diagram is found, so a broken
|
|
# toolchain can never pass as a skipped check.
|
|
- name: Validate Mermaid diagrams
|
|
run: python scripts/check_mermaid.py --strict
|
|
env:
|
|
PELE_REQUIRED: "1"
|
|
|
|
cross-references:
|
|
name: Cross-reference Check
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Validate cross-references
|
|
run: python scripts/check_cross_references.py
|
|
|
|
summary:
|
|
name: Summary
|
|
needs: [markdown-lint, link-check, mermaid, cross-references]
|
|
runs-on: ubuntu-latest
|
|
if: always()
|
|
steps:
|
|
- name: Check Job Results
|
|
run: |
|
|
if [ "${{ needs.markdown-lint.result }}" = "failure" ] || \
|
|
[ "${{ needs.link-check.result }}" = "failure" ] || \
|
|
[ "${{ needs.mermaid.result }}" = "failure" ] || \
|
|
[ "${{ needs.cross-references.result }}" = "failure" ]; then
|
|
echo "❌ Some documentation checks failed"
|
|
exit 1
|
|
else
|
|
echo "✅ All documentation checks passed!"
|
|
fi
|