Skip to content

Turn "Copy as markdown" into a split button and delete "Use Octopus docs with AI" - #3384

Open
enf0rc3 wants to merge 7 commits into
mainfrom
willlaugesen/nes-294-copy-as-markdown-split-button
Open

Turn "Copy as markdown" into a split button and delete "Use Octopus docs with AI"#3384
enf0rc3 wants to merge 7 commits into
mainfrom
willlaugesen/nes-294-copy-as-markdown-split-button

Conversation

@enf0rc3

@enf0rc3 enf0rc3 commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

NES-294

"Open this page as markdown" moves from the menu at the bottom of the article into a dropdown on the copy action, built on the shared SplitButton that "Open in Claude" uses. MarkdownLinks.astro and its script are deleted.

"Open all docs as markdown" is dropped rather than moved — llms-full.txt is nearly 2 million tokens and unusable with any current model. The route and its tests stay; only the UI link goes.

Behaviour change: a failed copy no longer reports anything. It used to show "Copy failed"; it now leaves the button as it was and announces nothing. The heading and code-block copy buttons keep their own failure tooltips.

SplitButton takes two changes and no new props: href becomes optional, and the primary gets a <slot />. The class and data-copy-md-url sit on the control, and the copy listener matches the primary half so the caret does not copy the page on its way to opening the menu.

The copy action's styles move out of main.css into the component, alongside how OpenInLlm and Menu already do it, so main.css only loses lines here.

The menu item uses design's markdown.svg, checked at 16px in both themes.

🤖 Generated with Claude Code

@team-marketing-branch-protections

Copy link
Copy Markdown

Pull request environment is available at https://stoctodocspr3384.z22.web.core.windows.net.

You can view the ephemeral environment status in Octopus Deploy.

This environment will be automatically deprovisioned when the pull request is closed, or after 7 days of inactivity.

@enf0rc3
enf0rc3 marked this pull request as ready for review August 19, 2026 02:05
@@ -1,57 +0,0 @@
---

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

This component

// `href`, a plain button forbids one - so the link attributes are handed over as
// a set rather than as three possibly-undefined props. `target` and `rel` say
// where a link opens, and mean nothing on a button.
const primaryLink = href ? { href, target, rel } : {};

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allows "non href" button that doesn't link anywhere. (client side only)

enf0rc3 and others added 6 commits August 19, 2026 15:42
…ocs with AI"

The "Open this page as markdown" link moves from the menu at the bottom of
the article into a dropdown on the copy action, built on the shared
SplitButton the "Open in Claude" button uses. "Open all docs as markdown"
is dropped: llms-full.txt is too large to use with any current model.

SplitButton now takes an optional href and a slotted primary label, so the
copy button can stay a <button> with its three stacked state labels.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Both callers pass a label or slot markup, so the check guarded against a
caller that does not exist.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The copy half needs a data attribute and a state class on the button
itself. Both now sit on the wrapping control instead, so SplitButton takes
no new props: the copy listener matches the primary half and reads the URL
from its ancestor, and the CSS and tests reach the button through
.octo-copy-md .split-btn__primary.

label goes back to required. The rest label comes from the prop and the two
results are slotted, stacked with it in one grid cell so the button is still
sized by the longest of the three.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Writing text to the clipboard is not something a reader can act on the
failure of, and clipboard.js already logs whichever rung of the write chain
refused. A failed copy now leaves the button as it was and announces
nothing, so the button carries one label and one result rather than three
stacked states.

The heading and code-block copy buttons keep their own tooltip failure
reporting.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The clipboard, the reporting width and the menu belong with the other copy
buttons. llm-endpoints keeps what is about the endpoints themselves: the .md
URL resolving, page eligibility, and llms-full.txt no longer being linked.

The width test was already in llm-endpoints and moves across with them.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Nothing outside CopyAsMarkdown, its script and its tests uses these classes,
so main.css was holding component-private rules. They go in the component's
own <style>, the way OpenInLlm, SplitButton and Menu already do it.

SplitButton, Button and Menu render the elements the rules land on, so those
carry their own scope and are reached with :global(). The .octo-copy-md the
wrapper is given does carry this component's scope, which is what keeps the
rules off every other button.

main.css now only loses lines for this change: the old "Use Octopus docs with
AI" block and the copy action's rules, 189 in total.

Also drops two tests that only guarded deleted markup staying deleted.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@enf0rc3
enf0rc3 force-pushed the willlaugesen/nes-294-copy-as-markdown-split-button branch from ed1d2de to f53e46a Compare August 19, 2026 04:11

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ellen provided an icon in Slack that looked quite different to this one. I see in the PR description it's mentioned that it should be switched.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh didn't notice that, ill update it to use the one she provided, thanks for spotting that!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rosslovas Done thanks!

Replaces the stand-in with design's asset. The badge is filled with the M and
the arrow knocked out of it, where the stand-in drew the badge as an outline.

Also drops commonmark from the dictionary, which the stand-in's comment was
the only thing needing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@enf0rc3
enf0rc3 requested a review from rosslovas August 19, 2026 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants