Added LaTeX syntax highlighting in the editor
This commit is contained in:
parent
6c8de21321
commit
0a63b80f8f
@ -41,18 +41,7 @@ var MarkdownHighlightRules = function() {
|
|||||||
// regexps are ordered -> the first match is used
|
// regexps are ordered -> the first match is used
|
||||||
|
|
||||||
this.$rules = {
|
this.$rules = {
|
||||||
"basic" : [{ // Math inline
|
"basic" : [{
|
||||||
token : ["constant.language.escape", "keyword", "constant.language.escape"],
|
|
||||||
regex : "(\\$)(.*)(\\$)"
|
|
||||||
}, { // Math block
|
|
||||||
token : "constant.language.escape",
|
|
||||||
regex : "\\$\\$|\\\\\\\\\\[|\\\\\\\\\\\\\\\\\\(",
|
|
||||||
next : "mathblock"
|
|
||||||
}, { // LaTeX block
|
|
||||||
token : "keyword",
|
|
||||||
regex : "\\\\?\\\\begin\\{[a-z]*\\*?\\}",
|
|
||||||
next : "latexblock"
|
|
||||||
}, {
|
|
||||||
token : "constant.language.escape",
|
token : "constant.language.escape",
|
||||||
regex : /\\[\\`*_{}\[\]()#+\-.!]/
|
regex : /\\[\\`*_{}\[\]()#+\-.!]/
|
||||||
}, { // code span `
|
}, { // code span `
|
||||||
@ -126,6 +115,17 @@ var MarkdownHighlightRules = function() {
|
|||||||
token : "markup.list",
|
token : "markup.list",
|
||||||
regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
|
regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
|
||||||
next : "listblock-start"
|
next : "listblock-start"
|
||||||
|
}, { // Math inline
|
||||||
|
token : ["constant.language.escape", "keyword", "constant.language.escape"],
|
||||||
|
regex : "(\\$)(.*)(\\$)"
|
||||||
|
}, { // Math block
|
||||||
|
token : "constant.language.escape",
|
||||||
|
regex : "\\$\\$|\\\\\\\\\\[|\\\\\\\\\\\\\\\\\\(",
|
||||||
|
next : "mathblock"
|
||||||
|
}, { // LaTeX block
|
||||||
|
token : "keyword",
|
||||||
|
regex : "\\\\?\\\\begin\\{[a-z]*\\*?\\}",
|
||||||
|
next : "latexblock"
|
||||||
}, {
|
}, {
|
||||||
include : "basic"
|
include : "basic"
|
||||||
}],
|
}],
|
||||||
@ -180,7 +180,7 @@ var MarkdownHighlightRules = function() {
|
|||||||
"mathblock" : [ {
|
"mathblock" : [ {
|
||||||
token : "constant.language.escape",
|
token : "constant.language.escape",
|
||||||
regex : "\\$\\$|\\\\\\\\\\]|\\\\\\\\\\\\\\\\\\)",
|
regex : "\\$\\$|\\\\\\\\\\]|\\\\\\\\\\\\\\\\\\)",
|
||||||
next : "basic"
|
next : "start"
|
||||||
}, {
|
}, {
|
||||||
include : "latex"
|
include : "latex"
|
||||||
} ],
|
} ],
|
||||||
@ -188,7 +188,7 @@ var MarkdownHighlightRules = function() {
|
|||||||
"latexblock" : [{
|
"latexblock" : [{
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "\\\\?\\\\end\\{[a-z]*\\*?\\}",
|
regex : "\\\\?\\\\end\\{[a-z]*\\*?\\}",
|
||||||
next : "basic"
|
next : "start"
|
||||||
}, {
|
}, {
|
||||||
include : "latex"
|
include : "latex"
|
||||||
}],
|
}],
|
||||||
|
Loading…
Reference in New Issue
Block a user