mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-15 15:55:56 +02:00
chore: upgrade Prettier + regenerate lock file (#5611)
* Bump deps * Run prettier * Format docs * Minor refactor * Collapse objects * Fix type * Update lock file
This commit is contained in:
parent
4dbc458a22
commit
3f1f8255a2
70 changed files with 1534 additions and 1517 deletions
|
@ -76,9 +76,7 @@ export function createExcerpt(fileString: string): string | undefined {
|
|||
return undefined;
|
||||
}
|
||||
|
||||
export function parseFrontMatter(
|
||||
markdownFileContent: string,
|
||||
): {
|
||||
export function parseFrontMatter(markdownFileContent: string): {
|
||||
frontMatter: Record<string, unknown>;
|
||||
content: string;
|
||||
} {
|
||||
|
@ -107,10 +105,11 @@ export function parseMarkdownContentTitle(
|
|||
|
||||
const content = contentUntrimmed.trim();
|
||||
|
||||
const IMPORT_STATEMENT = /import\s+(([\w*{}\s\n,]+)from\s+)?["'\s]([@\w/_.-]+)["'\s];?|\n/
|
||||
.source;
|
||||
const REGULAR_TITLE = /(?<pattern>#\s*(?<title>[^#\n{]*)+[ \t]*(?<suffix>({#*[\w-]+})|#)?\n*?)/
|
||||
.source;
|
||||
const IMPORT_STATEMENT =
|
||||
/import\s+(([\w*{}\s\n,]+)from\s+)?["'\s]([@\w/_.-]+)["'\s];?|\n/.source;
|
||||
const REGULAR_TITLE =
|
||||
/(?<pattern>#\s*(?<title>[^#\n{]*)+[ \t]*(?<suffix>({#*[\w-]+})|#)?\n*?)/
|
||||
.source;
|
||||
const ALTERNATE_TITLE = /(?<pattern>\s*(?<title>[^\n]*)\s*\n[=]+)/.source;
|
||||
|
||||
const regularTitleMatch = new RegExp(
|
||||
|
@ -150,9 +149,8 @@ export function parseMarkdownString(
|
|||
options?: {removeContentTitle?: boolean},
|
||||
): ParsedMarkdown {
|
||||
try {
|
||||
const {frontMatter, content: contentWithoutFrontMatter} = parseFrontMatter(
|
||||
markdownFileContent,
|
||||
);
|
||||
const {frontMatter, content: contentWithoutFrontMatter} =
|
||||
parseFrontMatter(markdownFileContent);
|
||||
|
||||
const {content, contentTitle} = parseMarkdownContentTitle(
|
||||
contentWithoutFrontMatter,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue