Core concepts
Understand projects, navigation, variants, static output, and the runtime, and all the configuration that follows becomes intuitive.
Rendering pipeline
A build starts by reading docs.yml and ends by writing a static directory. The whole process never executes any author code.
flowchart LR A["docs.yml<br/>pages/*.mdx<br/>openapi.yml"] --> B["@bitidocs/core<br/>config · navigation · MDX safe subset"] B --> C["@bitidocs/builder<br/>Shiki pre-highlighting · per-page rendering"] C --> D["@bitidocs/ui<br/>React server rendering → HTML"] D --> E["Static output<br/>HTML · .md · llms.txt<br/>sitemap · search index"] E --> F["Runtime<br/>Ask AI · MCP · playground proxy<br/>feedback · analytics"]
| Stage | Package | What it does |
|---|---|---|
| Parse | @bitidocs/core | Loads and validates docs.yml (docs.json is read too), resolves navigation, parses MDX into a syntax tree, and safely evaluates props |
| API | @bitidocs/openapi | Parses, upgrades (Swagger 2 / OAS 3.0 → 3.1), and dereferences OpenAPI, and generates examples and code snippets in 9 languages |
| Build | @bitidocs/builder | Pre-highlights every code block with Shiki (light / dark themes), renders each page, and writes HTML, Markdown, llms.txt, the sitemap, and the Pagefind search index |
| Render | @bitidocs/ui | React server rendering (renderToStaticMarkup) that outputs zero-hydration static HTML |
| Browser | @bitidocs/client | A tiny entry script: client-side navigation, theme switching, interactive components; heavy overlays like search, Ask AI, and the playground load on demand |
| Runtime | @bitidocs/runtime | Static file serving plus dynamic endpoints, provided by the hosted platform |
Site model
Navigation has three layers:
Tabs
Top-level entries shown in the header, such as this site's "Guides", "Components", "API Reference", and "Changelog". Declare them under tabs: in docs.yml and reference them in navigation: with - tab: <id>. A tab can have its own URL segment (slug) or omit it with skip-slug: true.
Sections
Groups in the sidebar, nestable to any depth. A section can have an overview page (path), can be collapsed by default (collapsed), and by default contributes a URL segment to the pages under it.
Pages and other nodes
page (one MDX file), link (an external or internal link), folder (generated automatically from a directory), api (a set of endpoint pages generated from OpenAPI), and changelog (a changelog generated from dated files).
See Navigation for the full syntax.
Variants: product × version × locale
The same navigation can be expanded into multiple variants. Each variant has its own URL prefix:
| Dimension | Config | Example URL prefix | Default |
|---|---|---|---|
| Locale | languages: | /en | The default locale has no prefix |
| Product | products: | /sdk | The first product also has its own segment |
| Version | versions: (or versions: under a product) | /v0 | The first version has no prefix |
Prefixes are joined in the order basepath → locale → product → version. For example, on this site:
- Chinese v1:
/guides/get-started/quickstart - English v1:
/en/guides/get-started/quickstart - Chinese v0:
/v0/guides/get-started/quickstart
Pages that have the same tab id, section titles, and page title across variants are treated as the same page: the locale and version switchers jump straight to the corresponding page, and the builder uses this to output hreflang and canonical tags for older versions.
Static output and the runtime
The static output handles browsing and search, and the runtime layers dynamic features on top. The hosted platform provides the runtime for every site.
Security model
ButterIX is a multi-tenant platform: docs uploaded by anyone are built on the same set of services. MDX therefore supports only a safe subset: you can use components and literal props, but you can't import arbitrary modules, write functions, or run scripts. See Safe subset for the reasons and details.
Site-level custom css / js (declared in docs.yml) still work. They're output to the page as plain <link /> and <script defer> tags and are unrelated to how doc content is parsed. The visual editor preview doesn't load custom scripts.