git ssb

30+

cel / git-ssb-web



Commit 577081af531455bb3b89f55c520f8b8cae122ef0

Don't highlight without lang. Avoid infinite loop

Fix %wRppKQhY3NwOqwIAXOF4za15B9oAL09U78wO4YptXjQ=.sha256
cel committed on 11/27/2016, 2:28:52 AM
Parent: aab7516eaaea84704ac2a3f1c5b868b6c2f2dd84

Files changed

lib/util.jschanged
lib/util.jsView
@@ -111,18 +111,11 @@
111111 }).join('')
112112 }
113113
114114 u.highlight = function(code, lang) {
115- if (code.length > 100000) return u.escape(code)
116- try {
117- return lang
118- ? Highlight.highlight(lang, code).value
119- : Highlight.highlightAuto(code).value
120- } catch(e) {
121- if (/^Unknown language/.test(e.message))
122- return u.escape(code)
123- throw e
124- }
115 + if (!lang || code.length > 100000) return u.escape(code)
116 + // auto highlighting removed because it was causing highlight.js to hang
117 + return Highlight.highlight(lang, code).value
125118 }
126119
127120 u.pre = function (text) {
128121 return '<pre>' + u.escape(text) + '</pre>'

Built with git-ssb-web