Add 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:
npm i starlight-contextual-menu
Inside your astro.config.mjs file add the starlightContextualMenu
plugin:
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 Claude
By default, when not specifying actions, only copy
and view
will appear in the menu.