From ac4acab7a1b7f81661b53863bb9dfdd808fc3da8 Mon Sep 17 00:00:00 2001 From: lazzzis Date: Sat, 14 Apr 2018 22:45:49 -0400 Subject: [PATCH] fix: escape text in code block when lang is text or not specified #31 (#32) --- lib/markdown/highlight.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/markdown/highlight.js b/lib/markdown/highlight.js index ddb999a47a..8505fc6285 100644 --- a/lib/markdown/highlight.js +++ b/lib/markdown/highlight.js @@ -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 `
${code}
` }