fix(theme): restore former code block theme-common internal APIs (#11153)

Co-authored-by: slorber <749374+slorber@users.noreply.github.com>
This commit is contained in:
Sébastien Lorber 2025-05-06 11:34:19 +02:00 committed by GitHub
parent 91d95a9ac1
commit 59e9eb20fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 0 deletions

View file

@ -39,6 +39,14 @@ export {
getPrismCssVariables,
CodeBlockContextProvider,
useCodeBlockContext,
// TODO Docusaurus v4: remove, only kept for internal retro-compatibility
// See https://github.com/facebook/docusaurus/pull/11153
parseCodeBlockTitle,
parseClassNameLanguage as parseLanguage,
parseLines,
getLineNumbersStart,
containsLineNumbers,
} from './utils/codeBlockUtils';
export {DEFAULT_SEARCH_TAG} from './utils/searchUtils';

View file

@ -188,6 +188,12 @@ export function getLineNumbersStart({
return getMetaLineNumbersStart(metastring);
}
// TODO Docusaurus v4: remove, only kept for internal retro-compatibility
// See https://github.com/facebook/docusaurus/pull/11153
export function containsLineNumbers(metastring?: string): boolean {
return Boolean(metastring?.includes('showLineNumbers'));
}
type ParseCodeLinesParam = {
/**
* The full metastring, as received from MDX. Line ranges declared here