feat(prose): configurable heading anchors and copy button#6735
Merged
Conversation
Contributor
📝 WalkthroughWalkthroughHeading prose components H1–H4 now accept an 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
commit: |
anchor and copy props
anchor and copy props
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔗 Linked issue
N/A
❓ Type of change
📚 Description
Two related additions that make prose components configurable through props and
<UTheme :props>, plus the shared plumbing to support it.Prose heading anchor generation was reading
useRuntimeConfig().public.mdc.headings.anchorLinks, which ties the components to@nuxtjs/mdc. As we move toward Comark (Vite friendly, no global runtime config) this needs to become framework agnostic. This adds ananchorprop toProseH1throughProseH4with the priority chain explicit prop /<UTheme :props>/app.configdefaultVariants, then the mdc config as a deprecated fallback, then a built in default of off. The fallback keeps@nuxt/contentand@nuxtjs/mdcusers on their current behavior (H2 to H4 enabled) with zero change, while content free Comark and plain Vue apps stay quiet by default. It also fixes a case where a booleananchorLinks: truewas ignored because only the object form was handled.ProsePregets acopyprop (boolean | ButtonProps) so the code copy button can be hidden or customized, mirroring thecloseprop onAlert. It defaults totrue, so current behavior is unchanged.To make these props controllable the way they are meant to be used (prose is rendered by the markdown renderer, not written by hand), a
prosenamespace is exposed on<UTheme :props>covering the prose components that have overridable props, so anchors, the copy button and similar can be toggled for a subtree. The docs AI chat uses this to keep heading anchors out of assistant messages.The typography docs are updated for both props.