diff --git a/.changeset/purple-hornets-yawn.md b/.changeset/purple-hornets-yawn.md new file mode 100644 index 000000000..520f81ecb --- /dev/null +++ b/.changeset/purple-hornets-yawn.md @@ -0,0 +1,5 @@ +--- +'myst-to-react': patch +--- + +Allow inline code to have children. diff --git a/packages/myst-to-react/src/code.tsx b/packages/myst-to-react/src/code.tsx index 7f932cbd2..8c89a2e61 100644 --- a/packages/myst-to-react/src/code.tsx +++ b/packages/myst-to-react/src/code.tsx @@ -7,6 +7,7 @@ import dark from 'react-syntax-highlighter/dist/esm/styles/hljs/vs2015.js'; import { DocumentIcon } from '@heroicons/react/24/outline'; import classNames from 'classnames'; import { CopyIcon } from './components/index.js'; +import { MyST } from './MyST.js'; type Props = { value: string; @@ -152,6 +153,14 @@ const inlineCode: NodeRenderer = ({ node }) => { ); } + if (node.children && node.children.length > 0) { + // The inline code can potentially have children + return ( + + + + ); + } return {node.value}; };