This repository has been archived by the owner on Apr 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathace-markdown.patch
89 lines (88 loc) · 3.14 KB
/
ace-markdown.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
diff --git a/lib/ace/mode/markdown_highlight_rules.js b/lib/ace/mode/markdown_highlight_rules.js
index 1e76cc0..9d76802 100644
--- a/lib/ace/mode/markdown_highlight_rules.js
+++ b/lib/ace/mode/markdown_highlight_rules.js
@@ -93,6 +93,10 @@ function github_embed(tag, prefix) {
token : "markup.list",
regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
next : "listblock-start"
+ }, { // LaTeX equation
+ token : "language",
+ regex : /\${1,2}(?=[^$]+)/,
+ next : "equation"
}, {
include : "basic"
});
@@ -101,6 +105,9 @@ function github_embed(tag, prefix) {
"basic" : [{
token : "constant.language.escape",
regex : /\\[\\`*_{}\[\]()#+\-.!]/
+ }, { // line brake
+ token : "underline",
+ regex : / {2}$/
}, { // code span `
token : "support.function",
regex : "(`+)(.*?[^`])(\\1)"
@@ -118,12 +125,18 @@ function github_embed(tag, prefix) {
'((?:[^\\)\\s\\\\]|\\\\.|\\s(?=[^"]))*)' + // href
'(\\s*"' + escaped('"') + '"\\s*)?' + // "title"
"(\\))" // )
+ }, { // wiki link
+ token : ["text", "markup.underline", "text"],
+ regex : /(\[{2})(.*?[^\]])(\]{2})/
}, { // strong ** __
token : "string.strong",
regex : "([*]{2}|[_]{2}(?=\\S))(.*?\\S[*_]*)(\\1)"
}, { // emphasis * _
token : "string.emphasis",
regex : "([*]|[_](?=\\S))(.*?\\S[*_]*)(\\1)"
+ }, { // emoji :smile:
+ token : "string",
+ regex : /:[a-z0-9+\-_]+:/
}, { //
token : ["text", "url", "text"],
regex : "(<)("+
@@ -194,7 +207,43 @@ function github_embed(tag, prefix) {
}, {
token : "support.function",
regex : ".+"
- } ]
+ } ],
+
+ "equation": [{ // LaTeX equation
+ // A comment. Tex comments start with % and go to
+ // the end of the line
+ token : "comment",
+ regex : "%.*$"
+ }, {
+ // A block
+ token : ["storage.type", "lparen", "variable.parameter", "rparen"],
+ regex : "(\\\\(?:begin|end))({)(\\w*)(})"
+ }, {
+ // A tex command e.g. \foo
+ token : "storage.type",
+ regex : "\\\\[a-zA-Z]+"
+ }, {
+ // Curly and square braces
+ token : "lparen",
+ regex : "[[({]"
+ }, {
+ // Curly and square braces
+ token : "rparen",
+ regex : "[\\])}]"
+ }, {
+ // superscript and subscript
+ token : "language",
+ regex : /[\^_]/
+ }, {
+ token : "constant.character.escape",
+ regex : "\\\\(?:[^a-zA-Z]|[a-zA-Z]+)"
+ }, {
+ token : "language",
+ regex : "\\${1,2}",
+ next : "start"
+ }, {
+ defaultToken : "string"
+ }]
});
this.embedRules(JavaScriptHighlightRules, "jscode-", [{