Skip to content

feat: add meta prop to custom renderer props#448

Closed
sleitor wants to merge 1 commit intovercel:mainfrom
sleitor:feature/custom-renderer-meta-prop
Closed

feat: add meta prop to custom renderer props#448
sleitor wants to merge 1 commit intovercel:mainfrom
sleitor:feature/custom-renderer-meta-prop

Conversation

@sleitor
Copy link
Contributor

@sleitor sleitor commented Mar 8, 2026

Closes #443

Summary

Exposes the code fence metastring as a meta prop in custom renderer callbacks. Previously, custom renderers received code, language, and isIncomplete but not the metastring (the text after the language identifier, e.g. ```rust {1} title="foo"meta = '{1} title="foo"').

The metastring was already being extracted internally (for startLine parsing) — this change simply forwards it to custom renderers.

Changes

  • lib/plugin-types.ts: Added meta?: string to CustomRendererProps
  • lib/components.tsx: Pass meta={metastring} to custom renderer component

Testing

Added tests verifying meta is passed when a metastring is present and is undefined when absent.

@vercel
Copy link
Contributor

vercel bot commented Mar 8, 2026

Someone is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

@@ -0,0 +1,54 @@
content = open('packages/streamdown/__tests__/custom-renderer.test.tsx').read()
Copy link
Contributor

Choose a reason for hiding this comment

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

A Python scaffolding script (add_tests.py) used to generate test code was accidentally committed to the repository.

Fix on Vercel

@sleitor
Copy link
Contributor Author

sleitor commented Mar 8, 2026

Closing as duplicate of #447 which was opened moments earlier for the same feature.

@sleitor sleitor closed this Mar 8, 2026
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.

Add code fence metastring to custom renderer props

1 participant