mirror of
https://github.com/seejohnrun/haste-server.git
synced 2024-11-21 20:31:20 +00:00
support .txt type
This commit is contained in:
parent
9378f2b2e4
commit
0e292ad21b
2 changed files with 12 additions and 3 deletions
|
@ -15,7 +15,16 @@ haste_document.prototype.load = function(key, callback, lang) {
|
|||
_this.key = key;
|
||||
_this.data = res.data;
|
||||
try {
|
||||
var high = lang ? hljs.highlight(lang, res.data) : hljs.highlightAuto(res.data);
|
||||
var high;
|
||||
if (lang === 'txt') {
|
||||
high = { value: res.data };
|
||||
}
|
||||
else if (lang) {
|
||||
high = hljs.highlight(lang, res.data);
|
||||
}
|
||||
else {
|
||||
high = hljs.highlightAuto(res.data);
|
||||
}
|
||||
} catch(err) {
|
||||
// failed highlight, fall back on auto
|
||||
high = hljs.highlightAuto(res.data);
|
||||
|
@ -129,7 +138,7 @@ haste.extensionMap = {
|
|||
lua: 'lua', pas: 'delphi', java: 'java', cpp: 'cpp', cc: 'cpp', m: 'objectivec',
|
||||
vala: 'vala', cs: 'cs', sql: 'sql', sm: 'smalltalk', lisp: 'lisp', ini: 'ini',
|
||||
diff: 'diff', bash: 'bash', sh: 'bash', tex: 'tex', erl: 'erlang', hs: 'haskell',
|
||||
md: 'markdown'
|
||||
md: 'markdown', txt: ''
|
||||
};
|
||||
|
||||
// Look up the extension preferred for a type
|
||||
|
|
2
static/application.min.js
vendored
2
static/application.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue