API Reference

Plugin

DocumenterCopyButton.CopyButtonType
CopyButton(; providers=nothing, prompt="Read", copy_label="Copy for AI")

A [Documenter.Plugin] that adds floating "Copy as Markdown" and "Open in AI" buttons to opted-in documentation pages.

Pages opt in by including a @copybutton block in their markdown source.

Keyword Arguments

  • providers: A list of AI providers for the "Open in AI" dropdown. Defaults to DEFAULT_PROVIDERS. Each element can be:
    • A Provider instance
    • A name => base_url pair (suffix defaults to "")
    • A name => (base_url, suffix) pair
    Set to an empty list to disable the "Open in AI" button.
  • prompt: A prefix string prepended to the URL when opening in an AI provider. Defaults to "Read".
  • copy_label: Label text for the copy button. Defaults to "Copy for AI".

Example

using DocumenterCopyButton: CopyButton

makedocs(;
    plugins = [CopyButton()],
    # ...
)

Custom providers:

CopyButton(providers = [
    "Claude" => "https://claude.ai/new?q=",
    "MyAI"   => ("https://myai.com/?q=", "&extra=1"),
])
source
DocumenterCopyButton.ProviderType
Provider(name, base_url, suffix)

An AI provider configuration for the "Open in AI" dropdown.

Fields

  • name::String: Display name shown in the dropdown (e.g. "Claude")
  • base_url::String: Base URL for the provider, to which the encoded query is appended
  • suffix::String: Optional suffix appended after the encoded query (e.g. "&hints=search")
source

At-Block

DocumenterCopyButton.CopyButtonBlocksType
@copybutton

A Documenter at-block that opts a page into the copy button feature.

The block content is an optional path to the source file that should be served to users when they click "Copy as Markdown." The path is relative to the doc root (e.g. src/tutorial.md). If the block is empty, it defaults to the page's own markdown source.

Usage

Opt in with the page's own source (most common):

```@copybutton
```

Opt in with a specific source file (e.g. a Literate.jl script):

```@copybutton
literate/tutorials/first_gate.jl
```
source