Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/docusaurus-theme-classic/src/theme-classic.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ declare module '@theme/CodeBlock' {
readonly children: ReactNode;
readonly className?: string;
readonly metastring?: string;
readonly title?: string;
readonly title?: ReactNode;
readonly language?: string;
readonly showLineNumbers?: boolean | number;
}
Expand Down
22 changes: 22 additions & 0 deletions website/_dogfooding/_pages tests/code-block-tests.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,28 @@ Multi-line text inside `pre` will turn into one-liner, but it's okay (https://gi
<br />
</CodeBlock>

## Code blocks with `ReactNode` in title

<CodeBlock
language="yaml"
title={
<div
style={{
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
}}>
<span>
<code>ReactNode</code> title
</span>{' '}
<span className="badge badge--primary">YAML</span>
</div>
}>
{`link:
title: front page
path: /docs/`}
</CodeBlock>

## Code blocks with line numbering tests

```jsx
Expand Down