Ox.parseMarkdown: in code spans or block, encode '>'

This commit is contained in:
rolux 2012-06-02 12:51:59 +02:00
parent 2482cec170
commit bd5a4b6318

View file

@ -389,14 +389,15 @@
function(match, classname, code) {
return '<pre><code'
+ (classname ? ' class="' + classname + '"' : '')
+ '>' + code + '\n</code></pre>';
+ '>' + code.trim().replace(/</g, '&lt;')
+ '\n</code></pre>';
}
)
.replace(
/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,
function(match, prev, backticks, code, next) {
return prev + '<code>'
+ Ox.encodeHTMLEntities(code.trim()) + '</code>';
+ code.trim().replace(/</g, '&lt;') + '</code>';
}
)
.replace(