Skip to content

Commit

Permalink
Merge pull request previm#40 from ryym/fix-code-block-rendering
Browse files Browse the repository at this point in the history
Escape html-tags in code block
  • Loading branch information
kannokanno committed Sep 1, 2015
2 parents 85a0979 + a392223 commit b130f24
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion preview/js/previm.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
(function(_doc, _win) {
var REFRESH_INTERVAL = 1000;
var marked_renderer = new marked.Renderer();
var defaultCodeBlockRenderer = marked_renderer.code;

marked_renderer.code = function (code, language) {
if(language === 'mermaid'){
return '<div class="mermaid">' + code + '</div>';
} else {
return '<pre><code>' + code + '</code></pre>';
return defaultCodeBlockRenderer.apply(this, arguments);
}
};

Expand Down

0 comments on commit b130f24

Please sign in to comment.