mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
38 lines
1 KiB
JavaScript
Executable file
38 lines
1 KiB
JavaScript
Executable file
define(function(require, exports, module) {
|
|
"use strict";
|
|
|
|
var oop = require("../lib/oop");
|
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
|
|
|
var LatexHighlightRules = function() {
|
|
this.$rules = {
|
|
"start" : [{
|
|
// A tex command e.g. \foo
|
|
token : "keyword",
|
|
regex : "\\\\(?:[^a-zA-Z]|[a-zA-Z]+)"
|
|
}, {
|
|
// Curly and square braces
|
|
token : "lparen",
|
|
regex : "[[({]"
|
|
}, {
|
|
// Curly and square braces
|
|
token : "rparen",
|
|
regex : "[\\])}]"
|
|
}, {
|
|
// Inline math between two $ symbols
|
|
token : "string",
|
|
regex : "\\$(?:(?:\\\\.)|(?:[^\\$\\\\]))*?\\$"
|
|
}, {
|
|
// A comment. Tex comments start with % and go to
|
|
// the end of the line
|
|
token : "comment",
|
|
regex : "%.*$"
|
|
}]
|
|
};
|
|
};
|
|
|
|
oop.inherits(LatexHighlightRules, TextHighlightRules);
|
|
|
|
exports.LatexHighlightRules = LatexHighlightRules;
|
|
|
|
});
|