diff --git a/.changeset/nasty-cars-battle.md b/.changeset/nasty-cars-battle.md new file mode 100644 index 000000000..4ba008773 --- /dev/null +++ b/.changeset/nasty-cars-battle.md @@ -0,0 +1,5 @@ +--- +'myst-to-react': patch +--- + +Add filename to codeblock diff --git a/packages/myst-to-react/src/code.tsx b/packages/myst-to-react/src/code.tsx index a29d943f4..17ae94e8d 100644 --- a/packages/myst-to-react/src/code.tsx +++ b/packages/myst-to-react/src/code.tsx @@ -4,6 +4,7 @@ import { useTheme } from '@myst-theme/providers'; import { LightAsync as SyntaxHighlighter } from 'react-syntax-highlighter'; import light from 'react-syntax-highlighter/dist/cjs/styles/hljs/xcode'; import dark from 'react-syntax-highlighter/dist/cjs/styles/hljs/vs2015'; +import DocumentIcon from '@heroicons/react/24/outline/DocumentIcon'; import classNames from 'classnames'; import { CopyIcon } from './components'; @@ -58,7 +59,18 @@ export function CodeBlock(props: Props) { border, })} > - {filename &&
{filename}
} + {filename && ( +
+ +
+ {filename} +
+
+ )} {value} - {showCopy && } + {showCopy && ( + + )} ); } @@ -102,6 +119,7 @@ const code: NodeRenderer = ({ node }) => { data-mdast-node-id={node.key} value={node.value || ''} lang={node.lang} + filename={node.filename} emphasizeLines={node.emphasizeLines} showLineNumbers={node.showLineNumbers} startingLineNumber={node.startingLineNumber}