Skip to content

Commit

Permalink
feat: add shiki/prismjs class names to distinguish highlight library
Browse files Browse the repository at this point in the history
  • Loading branch information
pengzhanbo committed May 29, 2024
1 parent cc8f441 commit ee77167
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 130 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ export const highlightPlugin = (
notationHighlight(parser)
}

/**
* Add the `prismjs` class name to distinguish the highlight library used for the current code block.
*/
parser.pre.classList.push('prismjs')

parser.pre.classList.push(languageClass)

return parser.stringify()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ export const preWrapperPlugin = (
// resolve title from token info
const title = resolveAttr(info, 'title') ?? language.ext

return `<div class="${languageClass}" data-ext="${language.ext}" data-title="${title}">${result}</div>`
/**
* Add the `prismjs` class name to distinguish the highlight library used for the current code block.
*/
return `<div class="prismjs ${languageClass}" data-ext="${language.ext}" data-title="${title}">${result}</div>`
}
}
Loading

0 comments on commit ee77167

Please sign in to comment.