Skip to content

Commit dfa098f

Browse files
committed
M, N, O
1 parent 9694cd1 commit dfa098f

File tree

19 files changed

+937
-681
lines changed

19 files changed

+937
-681
lines changed

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ module.exports = {
6969
// "object-curly-spacing": 1,
7070
// "key-spacing": "off",
7171
// "array-bracket-spacing": [1],
72-
"array-bracket-newline": [1, {
72+
"array-bracket-newline": [0, {
7373
multiline: true,
7474
minItems: 2
7575
}],

src/languages/makefile.js

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,64 +8,69 @@ Category: common
88

99
export default function(hljs) {
1010
/* Variables: simple (eg $(var)) and special (eg $@) */
11-
var VARIABLE = {
11+
const VARIABLE = {
1212
className: 'variable',
1313
variants: [
1414
{
1515
begin: '\\$\\(' + hljs.UNDERSCORE_IDENT_RE + '\\)',
16-
contains: [hljs.BACKSLASH_ESCAPE],
16+
contains: [ hljs.BACKSLASH_ESCAPE ]
1717
},
1818
{
1919
begin: /\$[@%<?\^\+\*]/
20-
},
20+
}
2121
]
2222
};
2323
/* Quoted string with variables inside */
24-
var QUOTE_STRING = {
24+
const QUOTE_STRING = {
2525
className: 'string',
26-
begin: /"/, end: /"/,
26+
begin: /"/,
27+
end: /"/,
2728
contains: [
2829
hljs.BACKSLASH_ESCAPE,
29-
VARIABLE,
30+
VARIABLE
3031
]
3132
};
3233
/* Function: $(func arg,...) */
33-
var FUNC = {
34+
const FUNC = {
3435
className: 'variable',
35-
begin: /\$\([\w-]+\s/, end: /\)/,
36+
begin: /\$\([\w-]+\s/,
37+
end: /\)/,
3638
keywords: {
3739
built_in:
3840
'subst patsubst strip findstring filter filter-out sort ' +
3941
'word wordlist firstword lastword dir notdir suffix basename ' +
4042
'addsuffix addprefix join wildcard realpath abspath error warning ' +
41-
'shell origin flavor foreach if or and call eval file value',
43+
'shell origin flavor foreach if or and call eval file value'
4244
},
43-
contains: [
44-
VARIABLE,
45-
]
45+
contains: [ VARIABLE ]
4646
};
4747
/* Variable assignment */
48-
var ASSIGNMENT = {
48+
const ASSIGNMENT = {
4949
begin: '^' + hljs.UNDERSCORE_IDENT_RE + '\\s*(?=[:+?]?=)'
5050
};
5151
/* Meta targets (.PHONY) */
52-
var META = {
52+
const META = {
5353
className: 'meta',
54-
begin: /^\.PHONY:/, end: /$/,
54+
begin: /^\.PHONY:/,
55+
end: /$/,
5556
keywords: {
5657
$pattern: /[\.\w]+/,
5758
'meta-keyword': '.PHONY'
5859
}
5960
};
6061
/* Targets */
61-
var TARGET = {
62+
const TARGET = {
6263
className: 'section',
63-
begin: /^[^\s]+:/, end: /$/,
64-
contains: [VARIABLE,]
64+
begin: /^[^\s]+:/,
65+
end: /$/,
66+
contains: [ VARIABLE ]
6567
};
6668
return {
6769
name: 'Makefile',
68-
aliases: ['mk', 'mak'],
70+
aliases: [
71+
'mk',
72+
'mak'
73+
],
6974
keywords: {
7075
$pattern: /[\w-]+/,
7176
keyword: 'define endef undefine ifdef ifndef ifeq ifneq else endif ' +
@@ -78,7 +83,7 @@ export default function(hljs) {
7883
FUNC,
7984
ASSIGNMENT,
8085
META,
81-
TARGET,
86+
TARGET
8287
]
8388
};
8489
}

src/languages/markdown.js

Lines changed: 93 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,46 @@ import * as regex from '../lib/regex.js';
1010

1111
export default function(hljs) {
1212
const INLINE_HTML = {
13-
begin: /<\/?[A-Za-z_]/, end: '>',
13+
begin: /<\/?[A-Za-z_]/,
14+
end: '>',
1415
subLanguage: 'xml',
1516
relevance: 0
1617
};
1718
const HORIZONTAL_RULE = {
18-
begin: '^[-\\*]{3,}', end: '$'
19+
begin: '^[-\\*]{3,}',
20+
end: '$'
1921
};
2022
const CODE = {
2123
className: 'code',
2224
variants: [
2325
// TODO: fix to allow these to work with sublanguage also
24-
{ begin: '(`{3,})(.|\\n)*?\\1`*[ ]*', },
25-
{ begin: '(~{3,})(.|\\n)*?\\1~*[ ]*', },
26+
{
27+
begin: '(`{3,})(.|\\n)*?\\1`*[ ]*'
28+
},
29+
{
30+
begin: '(~{3,})(.|\\n)*?\\1~*[ ]*'
31+
},
2632
// needed to allow markdown as a sublanguage to work
27-
{ begin: '```', end: '```+[ ]*$' },
28-
{ begin: '~~~', end: '~~~+[ ]*$' },
29-
{ begin: '`.+?`' },
33+
{
34+
begin: '```',
35+
end: '```+[ ]*$'
36+
},
37+
{
38+
begin: '~~~',
39+
end: '~~~+[ ]*$'
40+
},
41+
{
42+
begin: '`.+?`'
43+
},
3044
{
3145
begin: '(?=^( {4}|\\t))',
3246
// use contains to gobble up multiple lines to allow the block to be whatever size
3347
// but only have a single open/close tag vs one per line
3448
contains: [
35-
{ begin: '^( {4}|\\t)', end: '(\\n)$' }
49+
{
50+
begin: '^( {4}|\\t)',
51+
end: '(\\n)$'
52+
}
3653
],
3754
relevance: 0
3855
}
@@ -50,12 +67,15 @@ export default function(hljs) {
5067
contains: [
5168
{
5269
className: 'symbol',
53-
begin: /\[/, end: /\]/,
54-
excludeBegin: true, excludeEnd: true
70+
begin: /\[/,
71+
end: /\]/,
72+
excludeBegin: true,
73+
excludeEnd: true
5574
},
5675
{
5776
className: 'link',
58-
begin: /:\s*/, end: /$/,
77+
begin: /:\s*/,
78+
end: /$/,
5979
excludeBegin: true
6080
}
6181
]
@@ -65,35 +85,53 @@ export default function(hljs) {
6585
variants: [
6686
// too much like nested array access in so many languages
6787
// to have any real relevance
68-
{ begin: /\[.+?\]\[.*?\]/, relevance: 0 },
88+
{
89+
begin: /\[.+?\]\[.*?\]/,
90+
relevance: 0
91+
},
6992
// popular internet URLs
70-
{ begin: /\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/, relevance: 2 },
71-
{ begin: regex.concat(/\[.+?\]\(/, URL_SCHEME, /:\/\/.*?\)/), relevance: 2 },
93+
{
94+
begin: /\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,
95+
relevance: 2
96+
},
97+
{
98+
begin: regex.concat(/\[.+?\]\(/, URL_SCHEME, /:\/\/.*?\)/),
99+
relevance: 2
100+
},
72101
// relative urls
73-
{ begin: /\[.+?\]\([./?&#].*?\)/, relevance: 1 },
102+
{
103+
begin: /\[.+?\]\([./?&#].*?\)/,
104+
relevance: 1
105+
},
74106
// whatever else, lower relevance (might not be a link at all)
75-
{ begin: /\[.+?\]\(.*?\)/, relevance: 0 }
107+
{
108+
begin: /\[.+?\]\(.*?\)/,
109+
relevance: 0
110+
}
76111
],
77112
returnBegin: true,
78113
contains: [
79114
{
80115
className: 'string',
81116
relevance: 0,
82-
begin: '\\[', end: '\\]',
117+
begin: '\\[',
118+
end: '\\]',
83119
excludeBegin: true,
84-
returnEnd: true,
120+
returnEnd: true
85121
},
86122
{
87123
className: 'link',
88124
relevance: 0,
89-
begin: '\\]\\(', end: '\\)',
125+
begin: '\\]\\(',
126+
end: '\\)',
90127
excludeBegin: true,
91128
excludeEnd: true
92129
},
93130
{
94131
className: 'symbol',
95132
relevance: 0,
96-
begin: '\\]\\[', end: '\\]',
133+
begin: '\\]\\[',
134+
end: '\\]',
97135
excludeBegin: true,
98136
excludeEnd: true
99137
}
@@ -103,30 +141,43 @@ export default function(hljs) {
103141
className: 'strong',
104142
contains: [],
105143
variants: [
106-
{begin: /_{2}/, end: /_{2}/ },
107-
{begin: /\*{2}/, end: /\*{2}/ }
144+
{
145+
begin: /_{2}/,
146+
end: /_{2}/
147+
},
148+
{
149+
begin: /\*{2}/,
150+
end: /\*{2}/
151+
}
108152
]
109153
};
110154
const ITALIC = {
111155
className: 'emphasis',
112156
contains: [],
113157
variants: [
114-
{ begin: /\*(?!\*)/, end: /\*/ },
115-
{ begin: /_(?!_)/, end: /_/, relevance: 0},
158+
{
159+
begin: /\*(?!\*)/,
160+
end: /\*/
161+
},
162+
{
163+
begin: /_(?!_)/,
164+
end: /_/,
165+
relevance: 0
166+
}
116167
]
117168
};
118169
BOLD.contains.push(ITALIC);
119170
ITALIC.contains.push(BOLD);
120171

121-
var CONTAINABLE = [
172+
let CONTAINABLE = [
122173
INLINE_HTML,
123174
LINK
124175
];
125176

126177
BOLD.contains = BOLD.contains.concat(CONTAINABLE);
127178
ITALIC.contains = ITALIC.contains.concat(CONTAINABLE);
128179

129-
CONTAINABLE = CONTAINABLE.concat(BOLD,ITALIC);
180+
CONTAINABLE = CONTAINABLE.concat(BOLD, ITALIC);
130181

131182
const HEADER = {
132183
className: 'section',
@@ -135,27 +186,37 @@ export default function(hljs) {
135186
begin: '^#{1,6}',
136187
end: '$',
137188
contains: CONTAINABLE
138-
},
189+
},
139190
{
140191
begin: '(?=^.+?\\n[=-]{2,}$)',
141192
contains: [
142-
{ begin: '^[=-]*$' },
143-
{ begin: '^', end: "\\n", contains: CONTAINABLE },
193+
{
194+
begin: '^[=-]*$'
195+
},
196+
{
197+
begin: '^',
198+
end: "\\n",
199+
contains: CONTAINABLE
200+
}
144201
]
145-
}
202+
}
146203
]
147204
};
148205

149206
const BLOCKQUOTE = {
150207
className: 'quote',
151208
begin: '^>\\s+',
152209
contains: CONTAINABLE,
153-
end: '$',
210+
end: '$'
154211
};
155212

156213
return {
157214
name: 'Markdown',
158-
aliases: ['md', 'mkdown', 'mkd'],
215+
aliases: [
216+
'md',
217+
'mkdown',
218+
'mkd'
219+
],
159220
contains: [
160221
HEADER,
161222
INLINE_HTML,

src/languages/mathematica.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,10 @@ export default function(hljs) {
116116

117117
return {
118118
name: 'Mathematica',
119-
aliases: ['mma', 'wl'],
119+
aliases: [
120+
'mma',
121+
'wl'
122+
],
120123
classNameAliases: {
121124
brace: 'punctuation',
122125
pattern: 'type',
@@ -127,7 +130,9 @@ export default function(hljs) {
127130
'message-name': 'string'
128131
},
129132
contains: [
130-
hljs.COMMENT(/\(\*/, /\*\)/, {contains: ['self']}),
133+
hljs.COMMENT(/\(\*/, /\*\)/, {
134+
contains: [ 'self' ]
135+
}),
131136
PATTERNS,
132137
SLOTS,
133138
MESSAGES,

0 commit comments

Comments
 (0)