Skip to content
app.py
import json
from pathlib import Path
def load(path: Path) -> dict:

Returns the parsed file as a dict.

with path.open() as fh:
return json.load(fh)
cfg = load(Path("config.toml"))
cfg = load(Path("config.json"))
Warning:print(cfg["name"]) KeyError if unset
  1. Returns the parsed file as a dict.

starlight-codeblocks

This plugin adds 26 features to the Expressive Code blocks of Starlight. Use them to enrich code blocks, they're perfect for docs and training. Using an agent? Point it at the bundled skill.

Add the package to the site:

npm
npm install starlight-codeblocks

Then add codeblocks() to the Starlight plugins in astro.config.mjs:

astro.config.mjs
import { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight';
import codeblocks from 'starlight-codeblocks';Import the plugin
export default defineConfig({
integrations: [
starlight({
title: 'My docs',
plugins: [codeblocks()],Load the plugin
}),
],
});

The getting started page has the full steps.

  • Extend: your own API link adapters, playgrounds and runtimes.
  • Reference: every option, attribute, directive and style setting.

This website is agent-friendly: each page has a Markdown version at the same address with .md at the end, such as getting-started.md. llms.txt lists every page, and llms-full.txt has every page in one file.

Using an agent? Point it at the bundled skill. The skill tells the agent which feature suits each use, and how to write it.

This plugin builds on the excellent Expressive Code, which renders every code block in Starlight.

The [!code …] comment notation comes from the Shiki transformers and VitePress. Thank you to both projects. Most code blocks from VitePress work here unchanged.