starlight-llm-actions
v0.8.0
Published
Starlight plugin: Page Actions dropdown with Copy/View/PDF and Open-in-LLM buttons (ChatGPT, Claude, Gemini, Perplexity, T3 Chat, Cursor, Copilot).
Maintainers
Readme
Getting Started
Want to get started immediately? Check out the getting started guide on the documentation site.
Features
A Starlight plugin that adds a Page Actions dropdown to every doc page.
- Copy as Markdown — fetches the page's markdown source and writes to clipboard
- View as Markdown — opens the markdown source in a new tab
- Save as PDF — triggers the browser print dialog (off by default)
- Open in
<provider>— opens the current page in ChatGPT, Claude, Gemini, GitHub Copilot, Perplexity, T3 Chat, or Cursor using the most reliable per-provider strategy (URL fetch / inline content / clipboard + open) - Per-page opt-out via frontmatter
- Optional print/PDF snapshot disclaimer with branding row
Install
npm install starlight-llm-actionsUsage
Add the plugin to your Starlight config:
// astro.config.mjs
import { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight';
import starlightLlmActions from 'starlight-llm-actions';
export default defineConfig({
integrations: [
starlight({
title: 'My Docs',
plugins: [starlightLlmActions()],
}),
],
});Per-page opt-out
Add llmActions: false to a page's frontmatter to hide the dropdown there:
---
title: This page disables the actions
llmActions: false
---Enable the "Save as PDF" action
The PDF action is off by default — the print dialog can still be reached via Cmd/Ctrl+P, and many sites prefer not to advertise PDF as a primary artifact. To show the in-menu button:
starlightLlmActions({
actions: { printPdf: true },
})Configuration
For the full configuration reference — including per-provider overrides, the print/PDF snapshot disclaimer, and the markdown URL template — see the configuration docs.
Customization
Using a custom PageTitle override
If your Starlight config already has a custom PageTitle component, the plugin skips its automatic injection and logs a dev-mode warning. Import PageActions directly inside your override instead:
---
import Default from '@astrojs/starlight/components/PageTitle.astro';
import PageActions from 'starlight-llm-actions/components/PageActions.astro';
---
<div style="display: flex; align-items: flex-start; gap: 0.75rem;">
<Default {...Astro.props}><slot /></Default>
<PageActions />
</div>The plugin integration still handles route injection and config resolution — only the UI placement is up to you.
CSS variables
The plugin scopes its styles with a set of --llm-* custom properties on the .sl-llm-actions root element, all defaulting to Starlight design tokens. Override them in your site's custom CSS to retheme without touching internal selectors.
See CSS customization for the full reference.
License
Licensed under the MIT License, Copyright © Holden Hewett.
Icons sourced from Simple Icons under CC0. Brand
names and marks remain trademarks of their respective owners and appear
nominatively here only to identify the linked services. No endorsement is
implied. To use official brand assets, override providers.<name>.icon in
your plugin config.
See LICENSE for more information.
