Skip to main content

Configuration

OptionTypeDefaultDescription
enabledbooleantrueTurn the palette off without removing the plugin.
actionsActionOptions[]['copy', 'ai', 'share']Palette buttons, in order.
contentSelectorstring.markdownWhere selections count.
excludeSelectorstringpre, code, .hash-link, button, input, textareaSelections entirely inside these are ignored.
minWordsnumber3Shortest selection that shows the palette.
contextCharsnumber600Characters of surrounding text sent to AI either side of the passage.
textFragmentsbooleantrueAdd :~:text= to links so they highlight the passage.
ai.promptstringSee belowPrompt template.
ai.providersProviderOptions[]open-with-llm's, else ChatGPT and ClaudeEach needs a label and a url containing {prompt}. [] makes Ask AI copy the prompt.
ai.markdownFilestring | falseopen-with-llm's markdownFile, else falseFilename appended to docs routes for {markdownUrl}.
ai.maxUrlLengthnumber6000Longest provider URL before context is trimmed from the prompt.

Actions

ActionWhat it does
copyCopies a quote, citation, and deep link as rich text and plain text.
markdownCopies a Markdown blockquote with a linked citation.
aiShows a button per AI provider, plus Copy prompt.
shareOpens the native share sheet. Only shown on touch devices that support it.
teamsOpens Microsoft Teams' share dialog.
linkedinShares the link on LinkedIn.
xOpens a post on X with the quote and link.
blueskyOpens a Bluesky post with the quote and link.

Relabel a built-in with { action: 'copy', label: 'Copy quote' }. The social actions suit blogs more than docs, so they're off by default.

Custom actions

A custom action is { label, url }. These placeholders are URL-encoded into url: {text}, {shortText} (quoted, about 200 characters), {url} (the deep link), {title}, {section} (title and headings), and {quote} (the Markdown the markdown action copies).

export default {
plugins: [
[
'docusaurus-plugin-share-selection',
{
actions: [
'copy',
'ai',
{
label: 'Report issue',
url: 'https://github.com/acme/docs/issues/new?title=Docs:%20{title}&body={quote}',
},
],
},
],
],
};

AI prompt

I'm reading "{title}" and want help with a passage from it.
Section: {section}
Page: {url}
Full page as Markdown: {markdownUrl}

Passage:
"""
{selection}
"""

Surrounding text, with the passage marked:
"""
{context}
"""

Help me understand this passage.

{context} is the text before and after the selection, with [[PASSAGE]] where the selection sits. Lines whose placeholders are all empty are dropped. When a provider URL would pass ai.maxUrlLength, the plugin trims context first, then the passage. Copy prompt always copies the full version.

Styling

.share-selection {
--share-selection-background: #1c1e21;
--share-selection-color: #fff;
--share-selection-hover: rgb(255 255 255 / 14%);
--share-selection-radius: 12px;
}