Skip to content

Commit

Permalink
fix(markdown-loader): fix the bug of parse doc cause by template string
Browse files Browse the repository at this point in the history
  • Loading branch information
BeADre committed Aug 31, 2021
1 parent 9556795 commit 6e35002
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions packages/varlet-markdown-loader/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ function cardWrapper(html) {

function highlight(str, lang) {
if (lang && hljs.getLanguage(lang)) {
return `<pre>
<code>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.3.2/styles/color-brewer.min.css">
${hljs.highlight(lang, str, true).value}
</code>
</pre>
`
return (
'<pre class="hljs"><code>' +
'<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.3.2/styles/color-brewer.min.css">' +
hljs.highlight(lang, str, true).value +
'</code></pre>'
)
}

return ''
Expand Down

0 comments on commit 6e35002

Please sign in to comment.