@bhsd/codemirror-mediawiki 2.0.13 → 2.0.15

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
@@ -71,6 +71,8 @@ The textarea element replaced by CodeMirror.
71
71
  <details>
72
72
  <summary>Expand</summary>
73
73
 
74
+ *version added: 2.0.13*
75
+
74
76
  **type**: `string`
75
77
  The current language mode.
76
78
 
@@ -91,6 +93,8 @@ The CodeMirror EditorView instance.
91
93
  <details>
92
94
  <summary>Expand</summary>
93
95
 
96
+ *version added: 2.0.13*
97
+
94
98
  **returns**: `Promise<(doc: Text) => Diagnostic[] | Promise<Diagnostic[]>>`
95
99
  Get the default linting function, which can be used as the argument of [`lint`](#lint).
96
100
 
@@ -126,6 +130,8 @@ cm.lint( ( doc ) => [
126
130
  <details>
127
131
  <summary>Expand</summary>
128
132
 
133
+ *version added: 2.0.9*
134
+
129
135
  **param**: `string` the preferred [CodeMirror extensions](https://codemirror.net/docs/extensions/)
130
136
  Set the preferred CodeMirror extensions.
131
137
 
@@ -147,6 +153,8 @@ cm.prefer( [
147
153
  <details>
148
154
  <summary>Expand</summary>
149
155
 
156
+ *version added: 2.0.8*
157
+
150
158
  **param**: `string` the indentation string, default as tab
151
159
  Set the indentation string.
152
160
 
@@ -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
@@ -82,6 +80,7 @@ export declare const modeConfig: {
82
80
  noinclude: boolean;
83
81
  includeonly: boolean;
84
82
  onlyinclude: boolean;
83
+ img: boolean;
85
84
  };
86
85
  /**
87
86
  * HTML tags that are only self-closing.
@@ -115,9 +114,6 @@ export declare const modeConfig: {
115
114
  htmlTagAttribute: string;
116
115
  htmlTagBracket: string;
117
116
  htmlTagName: string;
118
- extTagAttribute: string;
119
- extTagBracket: string;
120
- extTagName: string;
121
117
  indenting: string;
122
118
  linkBracket: string;
123
119
  linkDelimiter: string;
@@ -150,42 +146,60 @@ export declare const modeConfig: {
150
146
  section: string;
151
147
  em: string;
152
148
  error: string;
153
- extTag: string;
154
149
  extGround: string;
150
+ ext2Ground: string;
151
+ ext2LinkGround: string;
152
+ ext3Ground: string;
153
+ ext3LinkGround: string;
154
+ extLinkGround: string;
155
+ extTag: string;
156
+ extTagAttribute: string;
157
+ extTagBracket: string;
158
+ extTagName: string;
155
159
  freeExtLink: string;
156
160
  freeExtLinkProtocol: string;
161
+ htmlEntity: string;
157
162
  link: string;
158
163
  linkGround: string;
159
164
  linkPageName: string;
160
- mnemonic: string;
161
165
  pageName: string;
162
166
  skipFormatting: string;
163
167
  strong: string;
164
168
  tableCaption: string;
165
- templateGround: string;
166
169
  templateExtGround: string;
170
+ templateExt2Ground: string;
171
+ templateExt2LinkGround: string;
172
+ templateExt3Ground: string;
173
+ templateExt3LinkGround: string;
174
+ templateExtLinkGround: string;
175
+ templateGround: string;
167
176
  templateLinkGround: string;
168
177
  templateVariableDelimiter: string;
169
178
  template2ExtGround: string;
179
+ template2Ext2Ground: string;
180
+ template2Ext3Ground: string;
181
+ templatet2Ext2LinkGround: string;
182
+ template2Ext3LinkGround: string;
183
+ template2ExtLinkGround: string;
170
184
  template2Ground: string;
185
+ template2LinkGround: string;
171
186
  template3ExtGround: string;
187
+ template3Ext2Ground: string;
188
+ template3Ext3Ground: string;
189
+ template3ExtLinkGround: string;
190
+ template3Ext2LinkGround: string;
191
+ template3Ext3LinkGround: string;
172
192
  template3Ground: string;
173
- pre: string;
174
- nowiki: string;
193
+ template3LinkGround: string;
175
194
  };
176
195
  /**
177
196
  * These are custom tokens (a.k.a. tags) that aren't mapped to any of the standardized tags.
178
197
  * Make sure these are also defined in tags() above.
179
198
  *
199
+ * TODO: pass parent Tags in Tag.define() where appropriate for better theming.
200
+ *
180
201
  * @see https://codemirror.net/docs/ref/#language.StreamParser.tokenTable
181
202
  * @see https://lezer.codemirror.net/docs/ref/#highlight.Tag%5Edefine
182
203
  */
183
204
  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
205
  };