/
githubmirror
/
docusaurus
Обзор
Документация
Войти
/
githubmirror
/
docusaurus
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/docusaurus-theme-classic/src/theme/CodeBlock/Content/Element.tsx
29 строк
1 KB
Sébastien Lorber
refactor(theme): introduce CodeBlockContextProvider + split into smaller components (#11062)
04 апр 2025, 21:11
Не верифицирован
04 апр 2025, 21:11
31b279f
Код
Авторство
О чём код?
/** * 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'; import clsx from 'clsx'; import Container from '@theme/CodeBlock/Container'; import type {Props} from '@theme/CodeBlock/Content/Element'; import styles from './styles.module.css'; // TODO Docusaurus v4: move this component at the root? // This component only handles a rare edge-case: <pre><MyComp/></pre> in MDX // <pre> tags in markdown map to CodeBlocks. They may contain JSX children. // When children is not a simple string, we just return a styled block without // actually highlighting. export default function CodeBlockJSX({children, className}: Props): ReactNode { return ( <Container as="pre" tabIndex={0} className={clsx(styles.codeBlockStandalone, 'thin-scrollbar', className)}> <code className={styles.codeBlockLines}>{children}</code> </Container> ); }