slint/docs
Nigel Breslaw b7278f6ca8
Enhance docs theme
Makes the dark theme look less like 'default Starlight'.
Syntax coloring uses the dark and light-plus theme.
Types are displayed as badges.
2024-11-17 21:31:32 +02:00
..
archive Next gen docs for 1.9 (#6766) 2024-11-14 15:52:35 +01:00
public Next gen docs for 1.9 (#6766) 2024-11-14 15:52:35 +01:00
site Update from slint-ui/website 2024-07-03 10:05:16 +00:00
src Enhance docs theme 2024-11-17 21:31:32 +02:00
tests Next gen docs for 1.9 (#6766) 2024-11-14 15:52:35 +01:00
.gitignore Next gen docs for 1.9 (#6766) 2024-11-14 15:52:35 +01:00
astro.config.mjs Bring more old docs content into the new system 2024-11-15 19:56:58 +02:00
biome.json Next gen docs for 1.9 (#6766) 2024-11-14 15:52:35 +01:00
ec.config.mjs Enhance docs theme 2024-11-17 21:31:32 +02:00
package.json Enhance new docs 2024-11-15 13:18:58 +02:00
playwright.config.ts Next gen docs for 1.9 (#6766) 2024-11-14 15:52:35 +01:00
README.md Enhance docs theme 2024-11-17 21:31:32 +02:00
tsconfig.json Next gen docs for 1.9 (#6766) 2024-11-14 15:52:35 +01:00
writing-style-guide.md Initial import of a basic style guide for docs, blog posts, and social media (#6389) 2024-09-30 18:02:24 +02:00

Slint Documentation

Prerequisites

  • Rust
  • Node.js
  • pnpm

🚀 Project Structure

The documentation site is built with Astro Starlight and reuses it's project structure.

docs/
├── public/
├── src/
│   ├── assets/
│   ├── content/
│   │   ├── docs/
│   │   └── config.ts
│   └── env.d.ts
├── tests/
├── astro.config.mjs
├── package.json
├── tsconfig.json
└── 

Starlight looks for .md or .mdx files in the src/content/docs/ directory. Each file is exposed as a route based on its file name.

Images can be added to src/assets/ and embedded in Markdown with a relative link. They will be optimized for download size and also their width and height will be extracted so the framework can render them without ugly content shifts.

Static assets, like favicons, can be placed in the public/ directory. Note that images in this folder will not be processed and optimized by Starlight.

Building the docs

The docs use a lot of autogenerated content. First create all the screenshots which will be placed at src/assets/generated/.

cargo run -p slint-docsnapper -- docs/src/content --overwrite

Then generate the slint auto generated content.

cargo xtask slintdocs

This xtask also installs the npm dependencies and builds the docs. The equivalent of:

pnpm i
pnpm run build

This will build the site and place it in dist/.

Live edit the docs

To run the live hot reloading dev server run:

pnpm start

This will start the dev server at localhost:4321/master/docs/slint.

🧞 Commands

All commands are run from the root of the project, from a terminal:

Command Action
pnpm i Installs dependencies
pnpm start Starts local dev server at localhost:4321
pnpm build Build your production site to ./dist/
pnpm preview Preview your build locally, before deploying
pnpm run astro ... Run CLI commands like astro add, astro check
npm run astro -- --help Get help using the Astro CLI

👀 Want to learn more about Astro and Starlight?

Check out Starlights docs, read the Astro documentation, or jump into the Astro Discord server.