fix(utils): allow partially backticked markdown h1 contentTitles (#8314)

This commit is contained in:
Josh Goldberg 2022-11-17 05:38:10 -05:00 committed by GitHub
parent 53aa9a2416
commit ac81765024
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 5 deletions

View file

@ -155,10 +155,7 @@ export function parseFrontMatter(markdownFileContent: string): {
}
function toTextContentTitle(contentTitle: string): string {
if (contentTitle.startsWith('`') && contentTitle.endsWith('`')) {
return contentTitle.substring(1, contentTitle.length - 1);
}
return contentTitle;
return contentTitle.replace(/`(?<text>[^`]*)`/g, '$<text>');
}
type ParseMarkdownContentTitleOptions = {