Skip to content

corsfix/starlight-contextual-menu

Repository files navigation

starlight-contextual-menu

Add contextual menu to your Starlight documentation.

starlight-contextual-menu

See it live on a real documentation page: https://corsfix.com/docs/cors-proxy/api

Usage

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 page
  • view: View as Markdown
  • chatgpt: Open in ChatGPT
  • claude: Open in Claude
  • lechat: Open in Mistral Le Chat
  • grok: Open in Grok

Options

  • 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.

License

MIT

About

Add contextual menu to your Starlight documentation.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •