mirror of
https://github.com/facebook/docusaurus.git
synced 2025-04-29 02:08:36 +02:00
fix(theme): CodeBlock should accept title
of ReactNode
type (#10999)
* allow ReactNode for CodeBlock title * fix example
This commit is contained in:
parent
7d36e2a8ff
commit
579bb5ad37
2 changed files with 23 additions and 1 deletions
|
@ -410,7 +410,7 @@ declare module '@theme/CodeBlock' {
|
||||||
readonly children: ReactNode;
|
readonly children: ReactNode;
|
||||||
readonly className?: string;
|
readonly className?: string;
|
||||||
readonly metastring?: string;
|
readonly metastring?: string;
|
||||||
readonly title?: string;
|
readonly title?: ReactNode;
|
||||||
readonly language?: string;
|
readonly language?: string;
|
||||||
readonly showLineNumbers?: boolean | number;
|
readonly showLineNumbers?: boolean | number;
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,6 +188,28 @@ Multi-line text inside `pre` will turn into one-liner, but it's okay (https://gi
|
||||||
<br />
|
<br />
|
||||||
</CodeBlock>
|
</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
|
## Code blocks with line numbering tests
|
||||||
|
|
||||||
```jsx
|
```jsx
|
||||||
|
|
Loading…
Add table
Reference in a new issue