Update index.js

This commit is contained in:
mmmsssttt404 2025-03-25 16:08:46 +08:00 committed by GitHub
parent f09b1bda77
commit c59b3ad423
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -12,7 +12,7 @@ export const getUniqueId = () => {
export const getRecommendTitleFromMarkdownString = markdown => {
// NOTE: We should read the title from the renderer cache because this regex matches in
// code blocks too.
const tokens = markdown.match(/#{1,6} {1,}(.*\S.*)(?:\n|$)/g)
const tokens = markdown.match(/#{1,6} {1,}(?! )(.*\S.*)(?:\n|$)/g)
if (!tokens) return ''
const headers = tokens.map(t => {
const matches = t.trim().match(/(#{1,6}) {1,}(.+)/)