Skip to content

Commit

Permalink
[zmarkdown] Solve a bug on code visitor
Browse files Browse the repository at this point in the history
  • Loading branch information
StaloneLab committed Aug 31, 2020
1 parent 2a2ce52 commit 04fdbd9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/zmarkdown/postprocessors/html-wrap-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ module.exports = () => (tree) => {

if (preElem.length === 1) {
const classes = preElem[0].children[0].properties.className
if (!classes) return

const langClass = classes.filter(c => c.startsWith('language'))
if (langClass.length === 0 || langClass[0].length < 9) return

const language = langClass[0].substring(9)

// rewrite class name
Expand Down

0 comments on commit 04fdbd9

Please sign in to comment.