Skip to content

Commit

Permalink
fix: escape text in code block when lang is text or not specified #31 (
Browse files Browse the repository at this point in the history
  • Loading branch information
lazzzis authored and yyx990803 committed Apr 15, 2018
1 parent 15a1ac8 commit ac4acab
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/markdown/highlight.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
const chalk = require('chalk')
const prism = require('prismjs')
const loadLanguages = require('prismjs/components/index')
const escapeHtml = require('escape-html')

// required to make embedded highlighting work...
loadLanguages(['markup', 'css', 'javascript'])

function wrap (code, lang) {
if (lang === 'text') {
code = escapeHtml(code)
}
return `<pre v-pre class="language-${lang}"><code>${code}</code></pre>`
}

Expand Down

0 comments on commit ac4acab

Please sign in to comment.