Skip to content

docs: add copy buttons to markdown code blocks - #33861

Merged
crisbeto merged 2 commits into
angular:mainfrom
MeAkib:feat/copy-code
Sep 25, 2026
Merged

crisbeto merged 2 commits into
angular:mainfrom
MeAkib:feat/copy-code

Conversation

@MeAkib

@MeAkib MeAkib commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Add copy functionality to all code blocks in documentation markdown content. Previously, only example viewer code and module import snippets had copy buttons, but regular markdown code blocks (like configuration examples) were missing this feature.

Old PR: #32004

Add copy functionality to all code blocks in documentation markdown content.
Previously, only example viewer code and module import snippets had copy
buttons, but regular markdown code blocks (like configuration examples)
were missing this feature.
@angular-robot angular-robot Bot added the area: docs Related to the documentation label Sep 23, 2026
Comment thread docs/src/app/shared/doc-viewer/doc-viewer.ts Outdated
Emit the copy button as part of the code block markup in the markdown renderer
and handle clicks with a single delegated listener in the `DocViewer`, instead
of attaching a component to every code block through a portal. This removes
the `CodeBlockCopyButton` component.
@crisbeto crisbeto added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels Sep 25, 2026
@crisbeto
crisbeto merged commit a70e8c4 into angular:main Sep 25, 2026
34 checks passed
@crisbeto

Copy link
Copy Markdown
Member

This PR was merged into the repository. The changes were merged into the following branches:

crisbeto pushed a commit that referenced this pull request Sep 25, 2026
* docs: add copy buttons to markdown code blocks

Add copy functionality to all code blocks in documentation markdown content.
Previously, only example viewer code and module import snippets had copy
buttons, but regular markdown code blocks (like configuration examples)
were missing this feature.

* docs: render code block copy buttons through markup

Emit the copy button as part of the code block markup in the markdown renderer
and handle clicks with a single delegated listener in the `DocViewer`, instead
of attaching a component to every code block through a portal. This removes
the `CodeBlockCopyButton` component.

(cherry picked from commit a70e8c4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: docs Related to the documentation target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants