Skip to content

Commit

Permalink
fix: fix style injection in highlighter
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-Hope committed Sep 20, 2024
1 parent eab4b3c commit 45074ab
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
15 changes: 8 additions & 7 deletions plugins/markdown/plugin-prismjs/src/node/prepareConfigFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export const prepareConfigFile = (
theme,
themes,
lineNumbers = true,
collapsedLines,
highlightLines = true,
collapsedLines = 'disable',
notationDiff,
notationErrorLevel,
notationFocus,
Expand Down Expand Up @@ -45,6 +46,12 @@ export const prepareConfigFile = (
)
}

if (highlightLines || notationHighlight) {
imports.push(
`import "${getRealPath('@vuepress/highlighter-helper/styles/notation-highlight.css', url)}"`,
)
}

if (notationDiff) {
imports.push(
`import "${getRealPath('@vuepress/highlighter-helper/styles/notation-diff.css', url)}"`,
Expand All @@ -63,12 +70,6 @@ export const prepareConfigFile = (
)
}

if (notationHighlight) {
imports.push(
`import "${getRealPath('@vuepress/highlighter-helper/styles/notation-highlight.css', url)}"`,
)
}

if (notationWordHighlight) {
imports.push(
`import "${getRealPath('@vuepress/highlighter-helper/styles/notation-word-highlight.css', url)}"`,
Expand Down
9 changes: 8 additions & 1 deletion plugins/markdown/plugin-shiki/src/node/prepareConfigFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export const prepareConfigFile = (
app: App,
{
lineNumbers = true,
collapsedLines,
highlightLines = true,
collapsedLines = 'disable',
notationDiff,
notationErrorLevel,
notationFocus,
Expand All @@ -31,6 +32,12 @@ export const prepareConfigFile = (
)
}

if (highlightLines || notationHighlight) {
imports.push(
`import "${getRealPath('@vuepress/highlighter-helper/styles/notation-highlight.css', url)}"`,
)
}

if (notationDiff) {
imports.push(
`import "${getRealPath('@vuepress/highlighter-helper/styles/notation-diff.css', url)}"`,
Expand Down

0 comments on commit 45074ab

Please sign in to comment.