Add contextual menu to your Starlight documentation.
npm install starlight-contextual-menuAdd contextual menu to your Starlight documentation.
See it live on a real documentation page: https://corsfix.com/docs/cors-proxy/api
Install the plugin by running the following command:
``bash`
npm i starlight-contextual-menu
Inside your astro.config.mjs file add the starlightContextualMenu plugin:
`js
import { defineConfig } from "astro/config";
import starlight from "@astrojs/starlight";
import starlightContextualMenu from "starlight-contextual-menu";
export default defineConfig({
integrations: [
starlight({
title: "My Docs",
plugins: [starlightContextualMenu({
actions: ["copy", "view", "chatgpt", "claude"]
})],
sidebar: [
...
],
}),
],
});
`
There are 4 built in actions:
- copy: Copy pageview
- : View as Markdownchatgpt
- : Open in ChatGPTclaude
- : Open in Claudelechat
- : Open in Mistral Le Chatgrok
- : Open in Grok
- actions (default: ['copy', 'view'])injectMarkdownRoutes
- (default: true) — set to false if another Starlight integration already adds the markdown routes to avoid duplicate route registration.hideMainActionLabel
- (default: false) - set to true to hide the main action text and only show icon
By default, when not specifying actions, only copy and view` will appear in the menu.