diff --git a/assets/copybutton.js b/assets/copybutton.js index eedeeb9..10626b6 100644 --- a/assets/copybutton.js +++ b/assets/copybutton.js @@ -16,6 +16,7 @@ var mdUrl = config.mdUrl || ""; var providers = config.providers || []; var prompt = config.prompt || ""; + var copyLabel = config.copyLabel || "Copy for AI"; var canonicalBase = config.canonicalBase || ""; var pagePath = config.pagePath || ""; @@ -50,17 +51,17 @@ var group = document.createElement("div"); group.className = "copybutton-group"; - // --- Copy as Markdown button --- + // --- Copy for AI button --- var copyBtn = document.createElement("button"); copyBtn.className = "button"; - copyBtn.title = "Copy page as Markdown"; - copyBtn.setAttribute("aria-label", "Copy page as Markdown"); + copyBtn.title = "Copy page as Markdown for AI"; + copyBtn.setAttribute("aria-label", "Copy page as Markdown for AI"); copyBtn.innerHTML = '' + '' + '' + '' + - 'Copy'; + '' + copyLabel + ''; copyBtn.addEventListener("click", function () { fetchAndCopy(mdUrl, function (err) { diff --git a/src/pipeline.jl b/src/pipeline.jl index bcd07e3..bca35d8 100644 --- a/src/pipeline.jl +++ b/src/pipeline.jl @@ -108,7 +108,7 @@ function _inject_html!(html_path, plugin, md_filename, md_content, rel_prefix, c injection = """ diff --git a/src/plugin.jl b/src/plugin.jl index 9dcb20b..432e022 100644 --- a/src/plugin.jl +++ b/src/plugin.jl @@ -35,7 +35,7 @@ const DEFAULT_PROVIDERS = Provider[ ] """ - CopyButton(; providers=nothing, prompt="Read") + 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. @@ -52,6 +52,7 @@ Pages opt in by including a [`@copybutton`](@ref CopyButtonBlocks) block in thei 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 @@ -76,10 +77,12 @@ CopyButton(providers = [ struct CopyButton <: Plugin providers::Vector{Provider} prompt::String + copy_label::String function CopyButton(; providers=nothing, prompt="Read", + copy_label="Copy for AI", ) provs = if providers === nothing copy(DEFAULT_PROVIDERS) @@ -91,6 +94,6 @@ struct CopyButton <: Plugin for p in providers ] end - new(provs, prompt) + new(provs, prompt, copy_label) end end