mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-27 21:48:41 +02:00
docs: document MDXComponents scope (#7503)
* docs: document MDXComponents scope * address reviews * add info
This commit is contained in:
parent
06a37112bb
commit
bac292d84b
3 changed files with 110 additions and 2 deletions
28
website/src/components/Highlight.tsx
Normal file
28
website/src/components/Highlight.tsx
Normal file
|
@ -0,0 +1,28 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import React, {type ReactNode} from 'react';
|
||||
|
||||
export default function Highlight({
|
||||
children,
|
||||
color,
|
||||
}: {
|
||||
children: ReactNode;
|
||||
color: string;
|
||||
}): JSX.Element {
|
||||
return (
|
||||
<span
|
||||
style={{
|
||||
backgroundColor: color,
|
||||
borderRadius: '2px',
|
||||
color: '#fff',
|
||||
padding: '0.2rem',
|
||||
}}>
|
||||
{children}
|
||||
</span>
|
||||
);
|
||||
}
|
14
website/src/theme/MDXComponents.tsx
Normal file
14
website/src/theme/MDXComponents.tsx
Normal file
|
@ -0,0 +1,14 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import MDXComponents from '@theme-original/MDXComponents';
|
||||
import Highlight from '@site/src/components/Highlight';
|
||||
|
||||
export default {
|
||||
...MDXComponents,
|
||||
highlight: Highlight,
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue