|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## What This Repo Is |
| 6 | + |
| 7 | +This is the **MAVLink Developer Guide** — a VitePress-based documentation site for the MAVLink drone messaging protocol. Source content lives in `en/` (English), with translations in `zh/` (Chinese) and `ko/` (Korean) managed via Crowdin. The published site is at mavlink.io. |
| 8 | + |
| 9 | +## Commands |
| 10 | + |
| 11 | +```bash |
| 12 | +# Install dependencies |
| 13 | +npm ci # or: yarn install |
| 14 | + |
| 15 | +# Local dev server with hot reload |
| 16 | +yarn start # alias for: yarn docs:dev |
| 17 | + |
| 18 | +# Production build (Linux) |
| 19 | +yarn docs:build |
| 20 | + |
| 21 | +# Production build (Windows) |
| 22 | +yarn docs:buildwin |
| 23 | + |
| 24 | +# Preview the built site |
| 25 | +yarn docs:preview |
| 26 | + |
| 27 | +# Check links |
| 28 | +yarn linkcheck |
| 29 | +``` |
| 30 | + |
| 31 | +CI (`.github/workflows/docs_deploy.yml`) uses `npm ci` + `npm run docs:build` on Node 20, then deploys to the `mavlink/mavlink.io` repo. |
| 32 | + |
| 33 | +## Architecture |
| 34 | + |
| 35 | +### Directory Layout |
| 36 | + |
| 37 | +- `en/` — primary English source; all editing happens here |
| 38 | +- `zh/`, `ko/` — machine/community translations synced from Crowdin (do not edit directly) |
| 39 | +- `.vitepress/config.mjs` — VitePress site config; sidebars are generated dynamically from `SUMMARY.md` files rather than hard-coded |
| 40 | +- `.vitepress/get_sidebar.js` — parses `SUMMARY.md` GitBook-style files to generate VitePress sidebar config |
| 41 | +- `.vitepress/theme/` — custom theme overrides |
| 42 | + |
| 43 | +### Navigation / Sidebar |
| 44 | + |
| 45 | +The sidebar for each language is built by reading that language's `en/SUMMARY.md` (and equivalent). This file is the authoritative table of contents — adding a new page requires both creating the `.md` file **and** adding it to `SUMMARY.md`. |
| 46 | + |
| 47 | +### Content Structure (`en/`) |
| 48 | + |
| 49 | +- `messages/` — auto-generated message reference docs (one per XML dialect: `common.md`, `ardupilotmega.md`, etc.) |
| 50 | +- `services/` — microservice protocol docs (mission, command, camera, gimbal, FTP, etc.) |
| 51 | +- `guide/` — protocol internals (serialization, routing, MAVLink 2, signing, etc.) |
| 52 | +- `mavgen_c/`, `mavgen_python/` — language-specific library usage guides |
| 53 | +- `contributing/` — contributor guides |
| 54 | +- `about/`, `getting_started/`, `file_formats/` — introductory and reference content |
| 55 | + |
| 56 | +### Excluded from Build |
| 57 | + |
| 58 | +Files matching `**/_*.md` are excluded from the VitePress build (used as includes/partials). Several language folders (`de`, `ja`, `ru`, `tr`, `uk`) are also excluded — only `en`, `zh`, and `ko` are active. |
| 59 | + |
| 60 | +## Authoring Conventions |
| 61 | + |
| 62 | +- VitePress callout syntax: `::: info`, `::: tip`, `::: warning`, `::: danger` (not `> **Note**` or `> **Tip**`) |
| 63 | +- Math is supported via `markdown-it-mathjax3` — use `$...$` inline and `$$...$$` for blocks |
| 64 | +- Tabs component is available via `@red-asuka/vitepress-plugin-tabs` |
| 65 | +- Internal links use relative paths to `.md` files (e.g., `../services/mission.md`) |
| 66 | +- The `EDITOR` environment variable enables "Open in your editor" links during local dev; omit it to get GitHub edit links instead |
| 67 | + |
| 68 | +## Translation Workflow |
| 69 | + |
| 70 | +- Crowdin config (`crowdin.yml`) maps `en/**/*.md` → `{lang}/**/{filename}.md` |
| 71 | +- Only edit English source in `en/`; translation PRs come from the Crowdin bot |
| 72 | +- New pages need to be in `en/SUMMARY.md` before Crowdin will pick them up |
0 commit comments