aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-04-25 16:51:26 -1000
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-04-27 08:02:07 -1000
commit52cd6161b4597f85436f521a01c2c14c08bf2d95 (patch)
treec398df7e911ed9ea78de4297fcbdc60301e07de3
parent5c2420033d0a8b85a07f847189dedbc0e800390a (diff)
downloadpatchfoo-52cd6161b4597f85436f521a01c2c14c08bf2d95.tar.gz
patchfoo-52cd6161b4597f85436f521a01c2c14c08bf2d95.zip
Unescape more symbols
-rw-r--r--lib/markdown-inline.js13
1 files changed, 3 insertions, 10 deletions
diff --git a/lib/markdown-inline.js b/lib/markdown-inline.js
index 238d0f1..56693e5 100644
--- a/lib/markdown-inline.js
+++ b/lib/markdown-inline.js
@@ -9,7 +9,7 @@ var inlineRenderer = new marked.Renderer()
inlineRenderer.urltransform = function (url) { return false }
inlineRenderer.link = function (href, title, text) { return unquote(shortenIfLink(text)) }
inlineRenderer.image = function (href, title, text) { return unquote(shortenIfLink(text)) }
-inlineRenderer.code = function(code, lang, escaped) { return escaped ? code : escape(code) }
+inlineRenderer.code = function(code, lang, escaped) { return escaped ? unquote(code) : code }
inlineRenderer.blockquote = function(quote) { return unquote(quote) }
inlineRenderer.html = function(html) { return false }
inlineRenderer.heading = function(text, level, raw) { return unquote(text)+' ' }
@@ -30,15 +30,8 @@ inlineRenderer.hashtag = function(preceding, tag) { return unquote((preceding||'
function unquote (text) {
return text.replace(/&amp;/g, '&').replace(/&quot;/g, '"').replace(/&#39;/g, '\'')
-}
-
-function escape (text) {
- return text
- .replace(/&/g, '&amp;')
- .replace(/</g, '&lt;')
- .replace(/>/g, '&gt;')
- .replace(/"/g, '&quot;')
- .replace(/\n+/g, ' ')
+ .replace(/&gt;/g, '>')
+ .replace(/&lt;/g, '<')
}
function shortenIfLink (text) {