Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add nodes/marks passing to resolveFn, update demo and README #168

Merged
merged 1 commit into from
Mar 12, 2024

Conversation

edvinasjurele
Copy link
Collaborator

@edvinasjurele edvinasjurele commented Mar 8, 2024

Closes #129

Exposing node and mark objects to be accessible via nodes and marks resolver functions. This adds possibility to access the whole rich text node, including type, attrs, and most importantly, content data, allowing more advanced configuration possibilities.

Especially useful when the component supports data passing via props only, and do not support <slot /> to pass the data as children, f.e. https://docs.astro.build/en/reference/api-reference/#code-

image

The PR makes it possible to configure such components with RichTextRenderer.

Changes

  • Expose the possibility to access content inside schema resolvers
  • Remove custom CodeBlock component in favour of native Astro Code component
  • Add Heading component which is has no slots, thus data is via props only as an example
  • Cover with unit tests

@edvinasjurele
Copy link
Collaborator Author

@Edo-San could you please review the code?

Copy link
Contributor

@Edo-San Edo-San left a comment

Choose a reason for hiding this comment

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

LGTM! @edvinasjurele
Thank you again for your effort! 🙏

Copy link

@yohlime yohlime left a comment

Choose a reason for hiding this comment

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

PR looks good, thank you @edvinasjurele and @Edo-San

@edvinasjurele edvinasjurele merged commit bb07726 into main Mar 12, 2024
12 checks passed
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.

Option to pass content as prop
4 participants