fix(v2): ignore imports when h1 heading parsing (#4646)

This commit is contained in:
Alexey Pyltsyn 2021-04-20 16:20:38 +03:00 committed by GitHub
parent 5088a1e48f
commit 4835222c16
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 2 deletions

View file

@ -86,10 +86,10 @@ export function parseMarkdownContentTitle(
const content = contentUntrimmed.trim();
const regularTitleMatch = /^(?<pattern>#\s*(?<title>[^#\n]*)+[ \t]*#?\n*?)/g.exec(
const regularTitleMatch = /^(?:import\s.*(from.*)?;?|\n)*?(?<pattern>#\s*(?<title>[^#\n]*)+[ \t]*#?\n*?)/g.exec(
content,
);
const alternateTitleMatch = /^(?<pattern>\s*(?<title>[^\n]*)\s*\n[=]+)/g.exec(
const alternateTitleMatch = /^(?:import\s.*(from.*)?;?|\n)*?(?<pattern>\s*(?<title>[^\n]*)\s*\n[=]+)/g.exec(
content,
);