Fix problem with span inside inline code

React doesn't allow a `span` inside an inline `code` element and throws an error in dev mode.
This commit is contained in:
Marcus Blättermann 2022-12-06 02:43:46 +01:00
parent 5e1a10f617
commit a280729491
No known key found for this signature in database
GPG Key ID: A1E1F04008AC450D

View File

@ -94,12 +94,12 @@ export const TypeAnnotation = ({ lang = 'python', link = true, children }) => {
}
)
return (
<code className={annotClassNames} aria-label="Type annotation">
<span className={annotClassNames} role="code" aria-label="Type annotation">
{elements.map((el, i) => (
<Fragment key={i}>{linkType(el, !!link)}</Fragment>
))}
{meta && <span className={classes['type-annotation-meta']}>{meta}</span>}
</code>
</span>
)
}