Commit 577081af531455bb3b89f55c520f8b8cae122ef0
Don't highlight without lang. Avoid infinite loop
Fix %wRppKQhY3NwOqwIAXOF4za15B9oAL09U78wO4YptXjQ=.sha256cel committed on 11/27/2016, 2:28:52 AM
Parent: aab7516eaaea84704ac2a3f1c5b868b6c2f2dd84
Files changed
lib/util.js | changed |
lib/util.js | |||
---|---|---|---|
@@ -111,18 +111,11 @@ | |||
111 | 111 … | }).join('') | |
112 | 112 … | } | |
113 | 113 … | ||
114 | 114 … | 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 | ||
125 | 118 … | } | |
126 | 119 … | ||
127 | 120 … | u.pre = function (text) { | |
128 | 121 … | return '<pre>' + u.escape(text) + '</pre>' |
Built with git-ssb-web