slint/docs/astro
Nigel Breslaw b4d2782ee4
docs: Fix missing trailing slash (#7353)
The docs were generated so links did not end with a trailing slash. e.g. https://docs.slint.dev/latest/docs/slint/guide/tooling/vscode but the website setup then redirects this to https://docs.slint.dev/latest/docs/slint/guide/tooling/vscode/. This now ensures the trailing slash is added.
2025-01-14 15:49:47 +02:00
..
public
src doc: Shorten and edit the main page button text 2025-01-14 09:58:40 +01:00
tests Docs tests: remove leading slash (#7170) 2024-12-19 14:01:49 +02:00
.gitignore
astro.config.mjs docs: Fix missing trailing slash (#7353) 2025-01-14 15:49:47 +02:00
biome.json
ec.config.mjs docs: Fix sideBar div stopping slint text being selected 2025-01-13 10:01:07 +01:00
package.json Bump version number to 1.10.0 2025-01-13 13:38:41 +00:00
playwright.config.ts More robust BASE_URL support for docs (#7158) 2024-12-19 10:58:40 +02:00
README.md Janitor: Remove trailing whitespaces from all files 2025-01-10 13:23:22 +01:00
tsconfig.json
writing-style-guide.md Janitor: Remove trailing whitespaces from all files 2025-01-10 13:23:22 +01: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/astro/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 in the astro directory:

cd docs/astro/
pnpm start

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

🧞 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.