Skip to content

Instantly share code, notes, and snippets.

@jariz
Created February 1, 2021 14:47
Show Gist options
  • Save jariz/99a917de387ca834fee22a060d8f55d9 to your computer and use it in GitHub Desktop.
Save jariz/99a917de387ca834fee22a060d8f55d9 to your computer and use it in GitHub Desktop.
<HtmlMapper html={html}>
{{
p: Body,
h1: (props) => <Title variant="large" {...props} />,
h2: (props) => <Title variant="regular" {...props} />,
h3: (props) => <Title variant="small" {...props} />,
h4: (props) => <Title variant="micro" {...props} />,
h5: (props) => <Title variant="tiny" {...props} />,
a: ({ href, children, ...rest }) =>
href?.startsWith("/") ? (
// assume internal link
<Link to={href}>{children}</Link>
) : (
<a href={href} {...rest}>
{children}
</a>
),
}}
</HtmlMapper>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment