@bhsd/codemirror-mediawiki 2.15.5 → 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 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
- * Configuration for the MediaWiki highlighting mode for CodeMirror.
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 modeConfig: {
11
- /**
12
- * All HTML/XML tags permitted in MediaWiki Core.
13
- *
14
- * @see https://www.mediawiki.org/wiki/Extension:CodeMirror#Extension_integration
15
- */
16
- htmlTags: string[];
17
- /**
18
- * HTML tags that are only self-closing.
19
- */
20
- voidHtmlTags: string[];
21
- selfClosingTags: string[];
22
- /**
23
- * Mapping of MediaWiki-esque token identifiers to a standardized lezer highlighting tag.
24
- * Values are one of the default highlighting tags.
25
- *
26
- * Once we allow use of other themes, we may want to tweak these values for aesthetic reasons.
27
- *
28
- * @see https://lezer.codemirror.net/docs/ref/#highlight.tags
29
- * @internal
30
- */
31
- tokens: {
32
- apostrophes: string;
33
- comment: string;
34
- convertBracket: string;
35
- convertDelimiter: string;
36
- convertFlag: string;
37
- convertLang: string;
38
- doubleUnderscore: string;
39
- em: string;
40
- error: string;
41
- extLink: string;
42
- extLinkBracket: string;
43
- extLinkProtocol: string;
44
- extLinkText: string;
45
- extTag: string;
46
- extTagAttribute: string;
47
- extTagAttributeValue: string;
48
- extTagBracket: string;
49
- extTagName: string;
50
- fileText: string;
51
- freeExtLink: string;
52
- freeExtLinkProtocol: string;
53
- hr: string;
54
- htmlEntity: string;
55
- htmlTagAttribute: string;
56
- htmlTagAttributeValue: string;
57
- htmlTagBracket: string;
58
- htmlTagName: string;
59
- imageParameter: string;
60
- linkBracket: string;
61
- linkDelimiter: string;
62
- linkPageName: string;
63
- linkText: string;
64
- linkToSection: string;
65
- list: string;
66
- magicLink: string;
67
- pageName: string;
68
- parserFunction: string;
69
- parserFunctionBracket: string;
70
- parserFunctionDelimiter: string;
71
- parserFunctionName: string;
72
- redirect: string;
73
- section: string;
74
- sectionHeader: string;
75
- signature: string;
76
- skipFormatting: string;
77
- strong: string;
78
- tableBracket: string;
79
- tableCaption: string;
80
- tableDefinition: string;
81
- tableDefinitionValue: string;
82
- tableDelimiter: string;
83
- tableDelimiter2: string;
84
- tableTd: string;
85
- tableTh: string;
86
- template: string;
87
- templateArgumentName: string;
88
- templateBracket: string;
89
- templateDelimiter: string;
90
- templateName: string;
91
- templateVariable: string;
92
- templateVariableBracket: string;
93
- templateVariableDelimiter: string;
94
- templateVariableName: string;
95
- };
96
- /**
97
- * These are custom tokens (a.k.a. tags) that aren't mapped to any of the standardized tags.
98
- *
99
- * @todo pass parent Tags in Tag.define() where appropriate for better theming.
100
- * @see https://codemirror.net/docs/ref/#language.StreamParser.tokenTable
101
- * @see https://lezer.codemirror.net/docs/ref/#highlight.Tag%5Edefine
102
- */
103
- readonly tokenTable: Record<string, Tag>;
104
- htmlAttrs: string[];
105
- elementAttrs: {
106
- table: string[];
107
- td: string[];
108
- th: string[];
109
- blockquote: string[];
110
- q: string[];
111
- ins: string[];
112
- del: string[];
113
- time: string[];
114
- ol: string[];
115
- li: string[];
116
- img: string[];
117
- rt: string[];
118
- data: string[];
119
- meta: string[];
120
- link: string[];
121
- gallery: string[];
122
- poem: string[];
123
- };
124
- extAttrs: {
125
- indicator: string[];
126
- langconvert: string[];
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;