We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Content in my markdown file:
Run vuepress dev, it throws an error:
vuepress dev
Run vuepress build, it doesn't throw an error. But the page is not rendered as expected:
vuepress build
I guess the cause is that code isn't escaped, when lang is 'text' or not specified.
code
vuepress/lib/markdown/highlight.js
Lines 8 to 10 in 86d4055
Since prism would automatically escape code:
> prism.highlight('<scheme>', prism.languages['html'], 'html') '<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>scheme</span><span class="token punctuation">></span></span>'
A quick solution might be:
const escapeHtml = require('escape-html') function wrap (code, lang) { if (lang === 'text') { code = escapeHtml(code) } return `<pre v-pre class="language-${lang}"><code>${code}</code></pre>` }
This solution works well both on vuepress dev and vuepress build. But I don't know if this is a good solution
The text was updated successfully, but these errors were encountered:
PR welcome.
Sorry, something went wrong.
fix: escape text in code block when lang is text or not specified vue…
4279357
…js#31
fix: escape text in code block when lang is text or not specified #31 (…
ac4acab
…#32)
No branches or pull requests
Content in my markdown file:
Run
vuepress dev
, it throws an error:Run
vuepress build
, it doesn't throw an error. But the page is not rendered as expected:I guess the cause is that
code
isn't escaped, when lang is 'text' or not specified.vuepress/lib/markdown/highlight.js
Lines 8 to 10 in 86d4055
Since prism would automatically escape
code
:A quick solution might be:
This solution works well both on
vuepress dev
andvuepress build
. But I don't know if this is a good solutionThe text was updated successfully, but these errors were encountered: