From 3bc6572a4b3becc0e0015b2e67107ae779b3ef9a Mon Sep 17 00:00:00 2001 From: Valentin Palkovic Date: Thu, 25 May 2023 14:40:41 +0200 Subject: [PATCH] Export SupportedLanguage and add plaintext support for SyntaxHighlighter --- code/ui/blocks/src/blocks/mdx.tsx | 3 ++- code/ui/blocks/src/components/Source.tsx | 3 ++- code/ui/components/src/index.ts | 1 + .../src/syntaxhighlighter/syntaxhighlighter-types.ts | 2 ++ .../ui/components/src/syntaxhighlighter/syntaxhighlighter.tsx | 4 +++- code/ui/components/src/typography/elements/Code.tsx | 3 ++- 6 files changed, 12 insertions(+), 4 deletions(-) diff --git a/code/ui/blocks/src/blocks/mdx.tsx b/code/ui/blocks/src/blocks/mdx.tsx index 3c1c69f87fc2..d8ab2bf87832 100644 --- a/code/ui/blocks/src/blocks/mdx.tsx +++ b/code/ui/blocks/src/blocks/mdx.tsx @@ -1,6 +1,7 @@ import type { FC, MouseEvent, PropsWithChildren, SyntheticEvent } from 'react'; import React, { useContext } from 'react'; import { NAVIGATE_URL } from '@storybook/core-events'; +import type { SupportedLanguage } from '@storybook/components'; import { Code, components, Icons, nameSpaceClassNames } from '@storybook/components'; import { global } from '@storybook/global'; import { styled } from '@storybook/theming'; @@ -43,7 +44,7 @@ export const CodeOrSourceMdx: FC = ({ className, children, const language = className && className.split('-'); return ( { diff --git a/code/ui/components/src/typography/elements/Code.tsx b/code/ui/components/src/typography/elements/Code.tsx index 58a64544950d..829491efe397 100644 --- a/code/ui/components/src/typography/elements/Code.tsx +++ b/code/ui/components/src/typography/elements/Code.tsx @@ -4,6 +4,7 @@ import React, { Children } from 'react'; import { SyntaxHighlighter } from '../../syntaxhighlighter/syntaxhighlighter'; import { isReactChildString } from '../lib/isReactChildString'; import { codeCommon } from '../lib/common'; +import type { SupportedLanguage } from '../../syntaxhighlighter/syntaxhighlighter-types'; const isInlineCodeRegex = /[\n\r]/g; @@ -60,7 +61,7 @@ export const Code = ({