Closed rbastiansch closed 1 year ago
Hey, I'm usign @graphcms/rich-text-html-renderer and found a situation where I would like to reuse element functions to use directly on my code inside of custom renderers, currently it only export astToHtmlString function.
@graphcms/rich-text-html-renderer
astToHtmlString
My use case:
import { astToHtmlString, Link } from '@graphcms/rich-text-html-renderer' ... renderers: { a: (props) => { const condition = true return condition ? `<a data-condition="special-data">${props.children}</a>` : Link(props) } }
With that I could import Link function and keep consistency with rich-text-html-renderer library without rewriting this function as a workaround.
Link
rich-text-html-renderer
Is today able to import thoses functions in another way or would be able to export together further?
PS: If it's okay to export those functions I could open a PR for that
Opened PR https://github.com/hygraph/rich-text/pull/107
This does make sense to include. I also had a similar use case.
I'll review your PR and publish it. Thanks, @rbastiansch!
Merged #107. I'll publish it soon
Hey, I'm usign
@graphcms/rich-text-html-renderer
and found a situation where I would like to reuse element functions to use directly on my code inside of custom renderers, currently it only exportastToHtmlString
function.My use case:
With that I could import
Link
function and keep consistency withrich-text-html-renderer
library without rewriting this function as a workaround.Is today able to import thoses functions in another way or would be able to export together further?
PS: If it's okay to export those functions I could open a PR for that