mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-16 00:06:11 +02:00
* fix(v2): optimize markdown parser regex * Change test description Co-authored-by: Nam Hoang Le <nam.hoang.le@mgm-tp.com>
This commit is contained in:
parent
e641caba10
commit
8c39826496
2 changed files with 53 additions and 2 deletions
|
@ -86,10 +86,10 @@ export function parseMarkdownContentTitle(
|
|||
|
||||
const content = contentUntrimmed.trim();
|
||||
|
||||
const regularTitleMatch = /^(?:import\s.*(from.*)?;?|\n)*?(?<pattern>#\s*(?<title>[^#\n{]*)+[ \t]*(?<suffix>({#*[\w-]+})|#)?\n*?)/g.exec(
|
||||
const regularTitleMatch = /^(?:import\s+\S+(\s+from\s+\S+)?;?|\n)*?(?<pattern>#\s*(?<title>[^#\n{]*)+[ \t]*(?<suffix>({#*[\w-]+})|#)?\n*?)/g.exec(
|
||||
content,
|
||||
);
|
||||
const alternateTitleMatch = /^(?:import\s.*(from.*)?;?|\n)*?(?<pattern>\s*(?<title>[^\n]*)\s*\n[=]+)/g.exec(
|
||||
const alternateTitleMatch = /^(?:import\s+\S+(\s+from\s+\S+)?;?|\n)*?(?<pattern>\s*(?<title>[^\n]*)\s*\n[=]+)/g.exec(
|
||||
content,
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue