@bhsd/codemirror-mediawiki 2.0.14 → 2.1.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.
@@ -28,7 +28,7 @@ export declare class CodeMirror6 {
28
28
  /** 立即更新语法检查 */
29
29
  update(): void;
30
30
  /** 添加扩展 */
31
- prefer(names: string[]): void;
31
+ prefer(names: readonly string[]): void;
32
32
  /** 设置缩进 */
33
33
  setIndent(indent: string): void;
34
34
  /** 获取默认linter */
package/dist/config.d.ts CHANGED
@@ -3,9 +3,7 @@
3
3
  * @license GPL-2.0-or-later
4
4
  * @link https://gerrit.wikimedia.org/g/mediawiki/extensions/CodeMirror
5
5
  */
6
- import { HighlightStyle } from '@codemirror/language';
7
6
  import { Tag } from '@lezer/highlight';
8
- import type { StreamParser } from '@codemirror/language';
9
7
  /**
10
8
  * Configuration for the MediaWiki highlighting mode for CodeMirror.
11
9
  * This is a separate class mainly to keep static configuration out of
@@ -20,73 +18,11 @@ export declare const modeConfig: {
20
18
  *
21
19
  * @see https://www.mediawiki.org/wiki/Extension:CodeMirror#Extension_integration
22
20
  */
23
- permittedHtmlTags: {
24
- b: boolean;
25
- bdi: boolean;
26
- del: boolean;
27
- i: boolean;
28
- ins: boolean;
29
- u: boolean;
30
- font: boolean;
31
- big: boolean;
32
- small: boolean;
33
- sub: boolean;
34
- sup: boolean;
35
- h1: boolean;
36
- h2: boolean;
37
- h3: boolean;
38
- h4: boolean;
39
- h5: boolean;
40
- h6: boolean;
41
- cite: boolean;
42
- code: boolean;
43
- em: boolean;
44
- s: boolean;
45
- strike: boolean;
46
- strong: boolean;
47
- tt: boolean;
48
- var: boolean;
49
- div: boolean;
50
- center: boolean;
51
- blockquote: boolean;
52
- q: boolean;
53
- ol: boolean;
54
- ul: boolean;
55
- dl: boolean;
56
- table: boolean;
57
- caption: boolean;
58
- pre: boolean;
59
- ruby: boolean;
60
- rb: boolean;
61
- rp: boolean;
62
- rt: boolean;
63
- rtc: boolean;
64
- p: boolean;
65
- span: boolean;
66
- abbr: boolean;
67
- dfn: boolean;
68
- kbd: boolean;
69
- samp: boolean;
70
- data: boolean;
71
- time: boolean;
72
- mark: boolean;
73
- br: boolean;
74
- wbr: boolean;
75
- hr: boolean;
76
- li: boolean;
77
- dt: boolean;
78
- dd: boolean;
79
- td: boolean;
80
- th: boolean;
81
- tr: boolean;
82
- noinclude: boolean;
83
- includeonly: boolean;
84
- onlyinclude: boolean;
85
- };
21
+ permittedHtmlTags: Set<string>;
86
22
  /**
87
23
  * HTML tags that are only self-closing.
88
24
  */
89
- implicitlyClosedHtmlTags: Record<string, true>;
25
+ implicitlyClosedHtmlTags: Set<string>;
90
26
  /**
91
27
  * Mapping of MediaWiki-esque token identifiers to a standardized lezer highlighting tag.
92
28
  * Values are one of the default highlighting tags. The idea is to use as many default tags as
@@ -115,10 +51,6 @@ export declare const modeConfig: {
115
51
  htmlTagAttribute: string;
116
52
  htmlTagBracket: string;
117
53
  htmlTagName: string;
118
- extTagAttribute: string;
119
- extTagBracket: string;
120
- extTagName: string;
121
- indenting: string;
122
54
  linkBracket: string;
123
55
  linkDelimiter: string;
124
56
  linkText: string;
@@ -150,42 +82,60 @@ export declare const modeConfig: {
150
82
  section: string;
151
83
  em: string;
152
84
  error: string;
153
- extTag: string;
154
85
  extGround: string;
86
+ ext2Ground: string;
87
+ ext2LinkGround: string;
88
+ ext3Ground: string;
89
+ ext3LinkGround: string;
90
+ extLinkGround: string;
91
+ extTag: string;
92
+ extTagAttribute: string;
93
+ extTagBracket: string;
94
+ extTagName: string;
155
95
  freeExtLink: string;
156
96
  freeExtLinkProtocol: string;
97
+ htmlEntity: string;
157
98
  link: string;
158
99
  linkGround: string;
159
100
  linkPageName: string;
160
- mnemonic: string;
161
101
  pageName: string;
162
102
  skipFormatting: string;
163
103
  strong: string;
164
104
  tableCaption: string;
165
- templateGround: string;
166
105
  templateExtGround: string;
106
+ templateExt2Ground: string;
107
+ templateExt2LinkGround: string;
108
+ templateExt3Ground: string;
109
+ templateExt3LinkGround: string;
110
+ templateExtLinkGround: string;
111
+ templateGround: string;
167
112
  templateLinkGround: string;
168
113
  templateVariableDelimiter: string;
169
114
  template2ExtGround: string;
115
+ template2Ext2Ground: string;
116
+ template2Ext3Ground: string;
117
+ templatet2Ext2LinkGround: string;
118
+ template2Ext3LinkGround: string;
119
+ template2ExtLinkGround: string;
170
120
  template2Ground: string;
121
+ template2LinkGround: string;
171
122
  template3ExtGround: string;
123
+ template3Ext2Ground: string;
124
+ template3Ext3Ground: string;
125
+ template3ExtLinkGround: string;
126
+ template3Ext2LinkGround: string;
127
+ template3Ext3LinkGround: string;
172
128
  template3Ground: string;
173
- pre: string;
174
- nowiki: string;
129
+ template3LinkGround: string;
175
130
  };
176
131
  /**
177
132
  * These are custom tokens (a.k.a. tags) that aren't mapped to any of the standardized tags.
178
133
  * Make sure these are also defined in tags() above.
179
134
  *
135
+ * TODO: pass parent Tags in Tag.define() where appropriate for better theming.
136
+ *
180
137
  * @see https://codemirror.net/docs/ref/#language.StreamParser.tokenTable
181
138
  * @see https://lezer.codemirror.net/docs/ref/#highlight.Tag%5Edefine
182
139
  */
183
140
  readonly tokenTable: Record<string, Tag>;
184
- /**
185
- * This defines the actual CSS class assigned to each tag/token.
186
- * Keep this in sync and in the same order as tags().
187
- *
188
- * @see https://codemirror.net/docs/ref/#language.TagStyle
189
- */
190
- getHighlightStyle(context: StreamParser<unknown>): HighlightStyle;
191
141
  };