Skip to content

feat: add heading link copy buttons - #1380

Draft
d3m1d0v wants to merge 1 commit into
d3m1d0v/markdown-viewer-diplodoc-adaptersfrom
d3m1d0v/markdown-viewer-heading-anchors
Draft

d3m1d0v wants to merge 1 commit into
d3m1d0v/markdown-viewer-diplodoc-adaptersfrom
d3m1d0v/markdown-viewer-heading-anchors

Conversation

@d3m1d0v

@d3m1d0v d3m1d0v commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Add HeadingAnchors to @gravity-ui/markdown-viewer/extensions to copy links to headings with existing unique IDs.

  • Show a # button on hover and keyboard focus, with copy feedback. Hide built-in Diplodoc heading controls while mounted.
  • Let applications build URLs with getHref({id, element}) and handle navigation with onClick(event, {id, element}).
  • Provide --g-md-heading-anchor-background-color for colored containers. Add usage examples to the viewer demo, editor preview, and README.

Summary by Sourcery

Add configurable heading anchor buttons for copying and navigating links to document headings.

New Features:

  • Add the HeadingAnchors extension for copying links to headings with unique IDs and configurable URL and navigation callbacks.

Enhancements:

  • Show heading anchor controls on hover and keyboard focus with localized copy feedback, while preserving heading content and supporting folding controls.
  • Support custom heading selection and colored-container backgrounds through --g-md-heading-anchor-background-color.

Documentation:

  • Document the heading anchor extension, callbacks, customization options, and cleanup behavior.
  • Add heading-anchor examples to the viewer demo and editor preview.

Tests:

  • Add unit, type, package-import, and visual coverage for copying links, callbacks, localization, focus behavior, folding headings, and colored containers.

@d3m1d0v
d3m1d0v added this pull request to stack #1365 October 22, 2026 18:55
@gravity-ui

gravity-ui Bot commented Oct 22, 2026

Copy link
Copy Markdown

Storybook Deployed

@gravity-ui

gravity-ui Bot commented Oct 22, 2026

Copy link
Copy Markdown

🎭 Playwright Report

This branch has not been deployed

No deployments
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.

1 participant