Skip to content

Commit

Permalink
fix(build): don't warn on blank lang in fences
Browse files Browse the repository at this point in the history
  • Loading branch information
brc-dd committed Jan 14, 2023
1 parent 1ae0596 commit 99ad162
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/node/markdown/plugins/highlight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,18 @@ export async function highlight(
lang =
lang.replace(lineNoRE, '').replace(vueRE, '').toLowerCase() || defaultLang

const langLoaded = highlighter.getLoadedLanguages().includes(lang as any)
if (!langLoaded) {
console.warn(
c.yellow(
`The language '${lang}' is not loaded, falling back to '${
defaultLang || 'txt'
}' for syntax highlighting.`
if (lang) {
const langLoaded = highlighter.getLoadedLanguages().includes(lang as any)
if (!langLoaded) {
console.warn(
c.yellow(
`The language '${lang}' is not loaded, falling back to '${
defaultLang || 'txt'
}' for syntax highlighting.`
)
)
)
lang = defaultLang
lang = defaultLang
}
}

const lineOptions = attrsToLines(attrs)
Expand Down

0 comments on commit 99ad162

Please sign in to comment.