git ssb

30+

cel / git-ssb-web



Commit 7eac9610f25b563106240cb97750fd27e660a643

Handle highlighting failure

Charles Lehner committed on 4/2/2016, 2:27:51 AM
Parent: cfc5b28733448e844b57db879704bbe89187d7b7

Files changed

index.jschanged
index.jsView
@@ -36,11 +36,17 @@
3636 return (/\.([^.]+)$/.exec(filename) || [,filename])[1]
3737 }
3838
3939 function highlight(code, lang) {
40- return lang
41- ? Highlight.highlight(lang, code).value
42- : Highlight.highlightAuto(code).value
40+ try {
41+ return lang
42+ ? Highlight.highlight(lang, code).value
43+ : Highlight.highlightAuto(code).value
44+ } catch(e) {
45+ if (/^Unknown language/.test(e.message))
46+ return escapeHTML(code)
47+ throw e
48+ }
4349 }
4450
4551 marked.setOptions({
4652 gfm: true,

Built with git-ssb-web