Shared Astro Starlight theme for Sentry docs sites.
pnpm add @sentry/starlight-theme @astrojs/starlight astroimport starlight from "@astrojs/starlight";
import sentryStarlightTheme, {
monochromeCodeTheme,
sentryAgentMarkdown,
} from "@sentry/starlight-theme";
import { defineConfig } from "astro/config";
export default defineConfig({
integrations: [
starlight({
title: "My Sentry project",
plugins: [sentryStarlightTheme(), sentryAgentMarkdown()],
}),
],
markdown: {
shikiConfig: {
theme: monochromeCodeTheme,
},
},
});The plugin installs the shared CSS, applies the monochrome Expressive Code theme, and overrides Starlight's ThemeSelect with an empty component because this theme is intentionally dark-only. Project-level customCss is kept after the package CSS so consuming docs sites can make small local adjustments.
sentryAgentMarkdown() generates static .md versions of Starlight docs pages for LLM and coding-agent clients:
/index.mdfor the root docs page./<slug>.mdfor every other docs page.
Markdown responses include YAML metadata (title, description, and url), use text/markdown; charset=utf-8, and rewrite internal docs links to .md URLs when possible. The exporter uses rendered HTML when Astro makes it available and otherwise falls back to normalized source Markdown/MDX, stripping common JSX wrappers and import/export statements.
The plugin also adds a copy-to-clipboard Markdown action below Starlight's right-sidebar table of contents. Disable this if a site has its own table-of-contents override:
sentryAgentMarkdown({
markdownActions: false,
});By default, the plugin only emits static Markdown routes. SSR/on-demand deployments can also enable Accept: text/markdown handling:
sentryAgentMarkdown({
contentNegotiation: true,
});Static deployments cannot vary an already-built HTML page by request headers without platform-level rewrites, so keep content negotiation disabled unless the site runs Astro middleware at request time.
This is intentionally lighter weight than Sentry's main docs pipeline, which converts built HTML after the site build. Highly custom MDX components may need site-specific Markdown authoring or a post-build exporter for perfect output.
This repo includes a local Starlight playground app at apps/playground. It depends on @sentry/starlight-theme via workspace:*, so package changes are tested through the same import path consuming projects use.
pnpm install
pnpm devUseful commands:
pnpm devstarts the playground site.pnpm lintruns ESLint and Prettier checks.pnpm formatformats the repo with Prettier.pnpm astro:checkruns Astro diagnostics for the playground.pnpm playground:buildbuilds the playground.pnpm typechecktypechecks the theme package.pnpm pack:dryshows the files that would be published.pnpm release:checkvalidates Craft/workflow package alignment.pnpm testruns release config validation, package typecheck, Astro check, playground build, and package dry run.
Releases are managed by Craft through GitHub Actions:
.github/workflows/release.ymlmanually prepares a release PR withgetsentry/action-prepare-release..github/workflows/merge-jobs.ymlruns after merges tomainandrelease/*, then uploads the npm tarball artifact named by the commit SHA..craft.ymlpublishes thesentry-starlight-theme-<version>.tgzartifact to npm as@sentry/starlight-themeand creates the GitHub release tag.
The release workflow expects the standard Sentry release bot variables and secrets: SENTRY_RELEASE_BOT_CLIENT_ID and SENTRY_RELEASE_BOT_PRIVATE_KEY.