mirror of
https://github.com/mintlify/docs.git
synced 2026-09-14 13:35:46 +08:00
15d9eaf50c
* docs: document download-pdf contextual menu option * Document contextual PDF download option (#6075) * Document contextual PDF download option * Tighten contextual PDF docs update * Remove contextual docs formatting change * add enterprise gate * add link in pdf-exports page * Update pdf-exports.mdx --------- Co-authored-by: Ethan Palm <56270045+ethanpalm@users.noreply.github.com> * docs: remove duplicate VS Code keyword in zh contextual menu frontmatter (#6082) Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com> * docs: translate contextual PDF download updates to es and fr (#6083) Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com> * docs: use sentence case for Expandable title in i18n guide (#6067) Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com> * docs: tighten slack agent description length for SEO (#6078) Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com> * docs: document download-pdf contextual menu option * Update ai/contextual-menu.mdx --------- Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com> Co-authored-by: Leyland Yang <yangleyland@gmail.com> Co-authored-by: Ethan Palm <56270045+ethanpalm@users.noreply.github.com>
191 lines
6.9 KiB
Plaintext
191 lines
6.9 KiB
Plaintext
---
|
|
title: "Contextual menu"
|
|
description: "Add a contextual menu to your docs with one-click AI integrations for ChatGPT, Claude, Perplexity, Google AI Studio, Devin, Windsurf, and MCP tools."
|
|
keywords: ["AI tools", "ChatGPT", "Claude", "Perplexity", "MCP", "Grok", "cursor", "vscode", "vs code", "Google AI Studio", "aistudio", "Devin", "Windsurf", "pdf"]
|
|
---
|
|
|
|
import { PreviewButton } from "/snippets/previewbutton.jsx"
|
|
import IconsRequired from "/snippets/icons-required.mdx";
|
|
|
|
The contextual menu provides quick access to AI-optimized content and direct integrations with popular AI tools. When users click the contextual menu on any page, they can copy content as context for AI tools or open it in an AI conversation. Supported tools include ChatGPT, Claude, Perplexity, Google AI Studio, Grok, Devin, Windsurf, and any custom tool you configure.
|
|
|
|
<Tip>
|
|
Pair the contextual menu with your hosted [`skill.md`](/ai/skillmd) file and [MCP server](/ai/model-context-protocol) so that users can install your product's full capabilities into their AI tools, not just the page they are reading.
|
|
</Tip>
|
|
|
|
## Menu options
|
|
|
|
The contextual menu includes several pre-built options that you can enable by adding their identifier to your configuration.
|
|
|
|
| Option | Identifier | Description |
|
|
|:--------|:------------|:-------------|
|
|
| **Copy page** | `copy` | Copies the current page as Markdown for pasting as context into AI tools |
|
|
| **View as Markdown** | `view` | Opens the current page as Markdown |
|
|
| **Ask assistant** | `assistant` | Opens the [assistant](/assistant/index) with the current page as context |
|
|
| **Download PDF** | `download-pdf` | Downloads the current page as a PDF. Available on [Enterprise plans](https://mintlify.com/pricing). |
|
|
| **Open in ChatGPT** | `chatgpt` | Creates a ChatGPT conversation with the current page as context |
|
|
| **Open in Claude** | `claude` | Creates a Claude conversation with the current page as context |
|
|
| **Open in Perplexity** | `perplexity` | Creates a Perplexity conversation with the current page as context |
|
|
| **Open in Grok** | `grok` | Creates a Grok conversation with the current page as context |
|
|
| **Open in Google AI Studio** | `aistudio` | Creates a Google AI Studio conversation with the current page as context |
|
|
| **Open in Devin** | `devin` | Creates a Devin session with the current page as context |
|
|
| **Open in Windsurf** | `windsurf` | Opens Windsurf Cascade with the current page as context |
|
|
| **Copy MCP server URL** | `mcp` | Copies your MCP server URL to the clipboard |
|
|
| **Copy MCP install command** | `add-mcp` | Copies the `npx add-mcp` command to install the MCP server |
|
|
| **Connect to Cursor** | `cursor` | Installs your hosted MCP server in Cursor |
|
|
| **Connect to VS Code** | `vscode` | Installs your hosted MCP server in VS Code |
|
|
| **Connect to Devin** | `devin-mcp` | Installs your hosted MCP server in Devin |
|
|
| **Download API spec** | `download-spec` | Downloads your deployment's OpenAPI spec. If there are multiple specs, downloads them as a zip archive. Only appears on API reference pages. |
|
|
| **Download PDF** | `download-pdf` | Downloads the current page as a PDF |
|
|
| **Custom options** | Object | Add custom options to the contextual menu |
|
|
|
|
<Frame>
|
|
<img
|
|
src="/images/contextual-menu/contextual-menu.png"
|
|
alt="The expanded contextual menu showing the Copy page, View as Markdown, Open in ChatGPT, and Open in Claude menu items."
|
|
/>
|
|
</Frame>
|
|
|
|
## Enable the contextual menu
|
|
|
|
Add the `contextual` field to your `docs.json` file and specify which options you want to include.
|
|
|
|
```json
|
|
{
|
|
"contextual": {
|
|
"options": [
|
|
"copy",
|
|
"view",
|
|
"assistant",
|
|
"chatgpt",
|
|
"claude",
|
|
"perplexity",
|
|
"grok",
|
|
"aistudio",
|
|
"devin",
|
|
"windsurf",
|
|
"mcp",
|
|
"cursor",
|
|
"vscode",
|
|
"devin-mcp",
|
|
"download-spec",
|
|
"download-pdf"
|
|
]
|
|
}
|
|
}
|
|
```
|
|
|
|
## Display location
|
|
|
|
By default, the contextual menu appears in the page header. You can configure it to display in the table of contents sidebar instead using the `display` option.
|
|
|
|
```json
|
|
{
|
|
"contextual": {
|
|
"options": ["copy", "view", "chatgpt", "claude"],
|
|
"display": "toc"
|
|
}
|
|
}
|
|
```
|
|
|
|
| Value | Description |
|
|
|:------|:------------|
|
|
| `header` | Displays options in the top-of-page context menu (default) |
|
|
| `toc` | Displays options in the table of contents sidebar |
|
|
|
|
## Add custom options
|
|
|
|
Create custom options in the contextual menu by adding an object to the `options` array. Each custom option requires these properties:
|
|
|
|
<ResponseField name="title" type="string" required>
|
|
The title of the option.
|
|
</ResponseField>
|
|
|
|
<ResponseField name="description" type="string" required>
|
|
The description of the option. Displayed beneath the title when the contextual menu expands.
|
|
</ResponseField>
|
|
|
|
<IconsRequired />
|
|
|
|
<ResponseField name="href" type="string | object" required>
|
|
The href of the option. Use a string for simple links or an object for dynamic links with query parameters.
|
|
|
|
<Expandable title="href object">
|
|
<ResponseField name="base" type="string" required>
|
|
The base URL for the option.
|
|
</ResponseField>
|
|
|
|
<ResponseField name="query" type="object" required>
|
|
The query parameters for the option.
|
|
|
|
<Expandable title="query object">
|
|
<ResponseField name="key" type="string" required>
|
|
The query parameter key.
|
|
</ResponseField>
|
|
|
|
<ResponseField name="value" type="string" required>
|
|
The query parameter value. Mintlify replaces the following placeholders with the corresponding values:
|
|
- Use `$page` to insert the current page content in Markdown.
|
|
- Use `$path` to insert the current page path.
|
|
- Use `$mcp` to insert the hosted MCP server URL.
|
|
</ResponseField>
|
|
</Expandable>
|
|
</ResponseField>
|
|
</Expandable>
|
|
</ResponseField>
|
|
|
|
Example custom option:
|
|
|
|
```json {9-14} wrap
|
|
{
|
|
"contextual": {
|
|
"options": [
|
|
"copy",
|
|
"view",
|
|
"chatgpt",
|
|
"claude",
|
|
"perplexity",
|
|
{
|
|
"title": "Request a feature",
|
|
"description": "Join the discussion on GitHub to request a new feature",
|
|
"icon": "plus",
|
|
"href": "https://github.com/orgs/mintlify/discussions/categories/feature-requests"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
```
|
|
|
|
### Custom option examples
|
|
|
|
<AccordionGroup>
|
|
<Accordion title="Simple link">
|
|
```json
|
|
{
|
|
"title": "Request a feature",
|
|
"description": "Join the discussion on GitHub",
|
|
"icon": "plus",
|
|
"href": "https://github.com/orgs/mintlify/discussions/categories/feature-requests"
|
|
}
|
|
```
|
|
</Accordion>
|
|
|
|
<Accordion title="Dynamic link with page content">
|
|
```json
|
|
{
|
|
"title": "Share on X",
|
|
"description": "Share this page on X",
|
|
"icon": "x",
|
|
"href": {
|
|
"base": "https://x.com/intent/tweet",
|
|
"query": [
|
|
{
|
|
"key": "text",
|
|
"value": "Check out this documentation: $page"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
```
|
|
</Accordion>
|
|
</AccordionGroup> |