@bhsd/codemirror-mediawiki 2.16.0 → 2.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -12
- package/dist/config.d.ts +121 -124
- package/dist/main.min.js +14 -13
- package/dist/mw.min.js +18 -17
- package/dist/ref.d.ts +16 -0
- package/dist/token.d.ts +1 -65
- package/i18n/en.json +4 -2
- package/i18n/zh-hans.json +4 -2
- package/i18n/zh-hant.json +4 -2
- package/mediawiki.css +7 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -39,10 +39,11 @@
|
|
|
39
39
|
- [highlightWhitespace](#highlightwhitespace)
|
|
40
40
|
- [highlightTrailingWhitespace](#highlighttrailingwhitespace)
|
|
41
41
|
- [highlightSelectionMatches](#highlightselectionmatches)
|
|
42
|
-
- [escape](#escape)
|
|
43
42
|
- [codeFolding](#codefolding)
|
|
44
43
|
- [scrollPastEnd](#scrollpastend)
|
|
44
|
+
- [escape](#escape)
|
|
45
45
|
- [tagMatching](#tagmatching)
|
|
46
|
+
- [refHover](#refhover)
|
|
46
47
|
|
|
47
48
|
</details>
|
|
48
49
|
|
|
@@ -279,32 +280,39 @@ Set the preferred CodeMirror extensions. Available extensions are introduced [la
|
|
|
279
280
|
```js
|
|
280
281
|
cm.prefer([
|
|
281
282
|
'allowMultipleSelections',
|
|
283
|
+
'autocompletion',
|
|
282
284
|
'bracketMatching',
|
|
283
285
|
'closeBrackets',
|
|
284
286
|
'highlightActiveLine',
|
|
285
287
|
'highlightSpecialChars',
|
|
286
288
|
'highlightWhitespace',
|
|
287
289
|
'highlightTrailingWhitespace',
|
|
290
|
+
'highlightSelectionMatches',
|
|
291
|
+
'codeFolding',
|
|
292
|
+
'scrollPastEnd',
|
|
288
293
|
|
|
289
294
|
// only available in MediaWiki mode
|
|
290
295
|
'escape',
|
|
291
|
-
'codeFolding',
|
|
292
296
|
'tagMatching',
|
|
297
|
+
'refHover',
|
|
293
298
|
]);
|
|
294
299
|
cm.prefer({
|
|
295
300
|
allowMultipleSelections: false,
|
|
296
301
|
autocompletion: false,
|
|
297
302
|
bracketMatching: false,
|
|
298
303
|
closeBrackets: false,
|
|
299
|
-
codeFolding: false,
|
|
300
304
|
highlightActiveLine: false,
|
|
301
305
|
highlightSpecialChars: false,
|
|
302
306
|
highlightWhitespace: false,
|
|
303
307
|
highlightTrailingWhitespace: false,
|
|
308
|
+
highlightSelectionMatches: false,
|
|
309
|
+
codeFolding: false,
|
|
310
|
+
scrollPastEnd: false,
|
|
304
311
|
|
|
305
312
|
// only available in MediaWiki mode
|
|
306
313
|
escape: false,
|
|
307
314
|
tagMatching: false,
|
|
315
|
+
refHover: false,
|
|
308
316
|
});
|
|
309
317
|
```
|
|
310
318
|
|
|
@@ -494,15 +502,6 @@ Highlight trailing whitespace in a red-orange color.
|
|
|
494
502
|
|
|
495
503
|
Highlight texts that match the selection in light green.
|
|
496
504
|
|
|
497
|
-
## escape
|
|
498
|
-
|
|
499
|
-
*version added: 2.2.2*
|
|
500
|
-
|
|
501
|
-
Key bindings:
|
|
502
|
-
|
|
503
|
-
- `Ctrl`/`Cmd` + `[`: Escape the selected text with HTML entities
|
|
504
|
-
- `Ctrl`/`Cmd` + `]`: Escape the selected text with URL encoding
|
|
505
|
-
|
|
506
505
|
## codeFolding
|
|
507
506
|
|
|
508
507
|
*version added: 2.3.0*
|
|
@@ -522,8 +521,23 @@ Key bindings:
|
|
|
522
521
|
|
|
523
522
|
Allow the editor to be scrolled down past the end of the document.
|
|
524
523
|
|
|
524
|
+
## escape
|
|
525
|
+
|
|
526
|
+
*version added: 2.2.2*
|
|
527
|
+
|
|
528
|
+
Key bindings:
|
|
529
|
+
|
|
530
|
+
- `Ctrl`/`Cmd` + `[`: Escape the selected text with HTML entities
|
|
531
|
+
- `Ctrl`/`Cmd` + `]`: Escape the selected text with URL encoding
|
|
532
|
+
|
|
525
533
|
## tagMatching
|
|
526
534
|
|
|
527
535
|
*version added: 2.4.1*
|
|
528
536
|
|
|
529
537
|
Matched or unmatched tags are highlighted in cyan or dark red when the cursor is inside.
|
|
538
|
+
|
|
539
|
+
## refHover
|
|
540
|
+
|
|
541
|
+
*version added: 2.17.0*
|
|
542
|
+
|
|
543
|
+
Show the content of the `<ref>` tag defined elsewhere when hovering.
|
package/dist/config.d.ts
CHANGED
|
@@ -1,133 +1,130 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* @file Configuration for the MediaWiki highlighting mode for CodeMirror.
|
|
2
3
|
* @author MusikAnimal and others
|
|
3
4
|
* @license GPL-2.0-or-later
|
|
4
5
|
* @see https://gerrit.wikimedia.org/g/mediawiki/extensions/CodeMirror
|
|
5
6
|
*/
|
|
6
7
|
import { Tag } from '@lezer/highlight';
|
|
7
8
|
/**
|
|
8
|
-
*
|
|
9
|
+
* All HTML/XML tags permitted in MediaWiki Core.
|
|
10
|
+
*
|
|
11
|
+
* @see https://www.mediawiki.org/wiki/Extension:CodeMirror#Extension_integration
|
|
9
12
|
*/
|
|
10
|
-
declare const
|
|
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
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
ref: string[];
|
|
128
|
-
references: string[];
|
|
129
|
-
charinsert: string[];
|
|
130
|
-
templatestyles: string[];
|
|
131
|
-
};
|
|
13
|
+
export declare const htmlTags: string[],
|
|
14
|
+
/** HTML tags that are only self-closing. */
|
|
15
|
+
voidHtmlTags: string[],
|
|
16
|
+
/** HTML tags that can be self-closing. */
|
|
17
|
+
selfClosingTags: string[],
|
|
18
|
+
/**
|
|
19
|
+
* Mapping of MediaWiki-esque token identifiers to a standardized lezer highlighting tag.
|
|
20
|
+
* Values are one of the default highlighting tags.
|
|
21
|
+
*
|
|
22
|
+
* Once we allow use of other themes, we may want to tweak these values for aesthetic reasons.
|
|
23
|
+
*
|
|
24
|
+
* @see https://lezer.codemirror.net/docs/ref/#highlight.tags
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
tokens: {
|
|
28
|
+
apostrophes: string;
|
|
29
|
+
comment: string;
|
|
30
|
+
convertBracket: string;
|
|
31
|
+
convertDelimiter: string;
|
|
32
|
+
convertFlag: string;
|
|
33
|
+
convertLang: string;
|
|
34
|
+
doubleUnderscore: string;
|
|
35
|
+
em: string;
|
|
36
|
+
error: string;
|
|
37
|
+
extLink: string;
|
|
38
|
+
extLinkBracket: string;
|
|
39
|
+
extLinkProtocol: string;
|
|
40
|
+
extLinkText: string;
|
|
41
|
+
extTag: string;
|
|
42
|
+
extTagAttribute: string;
|
|
43
|
+
extTagAttributeValue: string;
|
|
44
|
+
extTagBracket: string;
|
|
45
|
+
extTagName: string;
|
|
46
|
+
fileText: string;
|
|
47
|
+
freeExtLink: string;
|
|
48
|
+
freeExtLinkProtocol: string;
|
|
49
|
+
hr: string;
|
|
50
|
+
htmlEntity: string;
|
|
51
|
+
htmlTagAttribute: string;
|
|
52
|
+
htmlTagAttributeValue: string;
|
|
53
|
+
htmlTagBracket: string;
|
|
54
|
+
htmlTagName: string;
|
|
55
|
+
imageParameter: string;
|
|
56
|
+
linkBracket: string;
|
|
57
|
+
linkDelimiter: string;
|
|
58
|
+
linkPageName: string;
|
|
59
|
+
linkText: string;
|
|
60
|
+
linkToSection: string;
|
|
61
|
+
list: string;
|
|
62
|
+
magicLink: string;
|
|
63
|
+
pageName: string;
|
|
64
|
+
parserFunction: string;
|
|
65
|
+
parserFunctionBracket: string;
|
|
66
|
+
parserFunctionDelimiter: string;
|
|
67
|
+
parserFunctionName: string;
|
|
68
|
+
redirect: string;
|
|
69
|
+
section: string;
|
|
70
|
+
sectionHeader: string;
|
|
71
|
+
signature: string;
|
|
72
|
+
skipFormatting: string;
|
|
73
|
+
strong: string;
|
|
74
|
+
tableBracket: string;
|
|
75
|
+
tableCaption: string;
|
|
76
|
+
tableDefinition: string;
|
|
77
|
+
tableDefinitionValue: string;
|
|
78
|
+
tableDelimiter: string;
|
|
79
|
+
tableDelimiter2: string;
|
|
80
|
+
tableTd: string;
|
|
81
|
+
tableTh: string;
|
|
82
|
+
template: string;
|
|
83
|
+
templateArgumentName: string;
|
|
84
|
+
templateBracket: string;
|
|
85
|
+
templateDelimiter: string;
|
|
86
|
+
templateName: string;
|
|
87
|
+
templateVariable: string;
|
|
88
|
+
templateVariableBracket: string;
|
|
89
|
+
templateVariableDelimiter: string;
|
|
90
|
+
templateVariableName: string;
|
|
91
|
+
},
|
|
92
|
+
/**
|
|
93
|
+
* These are custom tokens (a.k.a. tags) that aren't mapped to any of the standardized tags.
|
|
94
|
+
*
|
|
95
|
+
* @todo pass parent Tags in Tag.define() where appropriate for better theming.
|
|
96
|
+
* @see https://codemirror.net/docs/ref/#language.StreamParser.tokenTable
|
|
97
|
+
* @see https://lezer.codemirror.net/docs/ref/#highlight.Tag%5Edefine
|
|
98
|
+
*/
|
|
99
|
+
tokenTable: Record<string, Tag>,
|
|
100
|
+
/** Common HTML attributes permitted in MediaWiki Core. */
|
|
101
|
+
htmlAttrs: string[],
|
|
102
|
+
/** HTML attributes that are only permitted on certain HTML tags. */
|
|
103
|
+
elementAttrs: {
|
|
104
|
+
table: string[];
|
|
105
|
+
td: string[];
|
|
106
|
+
th: string[];
|
|
107
|
+
blockquote: string[];
|
|
108
|
+
q: string[];
|
|
109
|
+
ins: string[];
|
|
110
|
+
del: string[];
|
|
111
|
+
time: string[];
|
|
112
|
+
ol: string[];
|
|
113
|
+
li: string[];
|
|
114
|
+
img: string[];
|
|
115
|
+
rt: string[];
|
|
116
|
+
data: string[];
|
|
117
|
+
meta: string[];
|
|
118
|
+
link: string[];
|
|
119
|
+
gallery: string[];
|
|
120
|
+
poem: string[];
|
|
121
|
+
},
|
|
122
|
+
/** HTML attributes that are only permitted on certain extension tags. */
|
|
123
|
+
extAttrs: {
|
|
124
|
+
indicator: string[];
|
|
125
|
+
langconvert: string[];
|
|
126
|
+
ref: string[];
|
|
127
|
+
references: string[];
|
|
128
|
+
charinsert: string[];
|
|
129
|
+
templatestyles: string[];
|
|
132
130
|
};
|
|
133
|
-
export default modeConfig;
|