@bhsd/codemirror-mediawiki 2.23.1 → 2.24.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/dist/static.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Config } from 'wikiparser-node';
1
+ import type { ConfigData } from 'wikiparser-node';
2
2
  import type { MwConfig } from './token';
3
3
  export declare const tagModes: {
4
4
  onlyinclude: string;
@@ -24,4 +24,4 @@ export declare const tagModes: {
24
24
  maplink: string;
25
25
  graph: string;
26
26
  };
27
- export declare const getStaticMwConfig: ({ variable, parserFunction: [p0, p1, ...p2], protocol, nsid, functionHook, variants, redirection, ext, doubleUnderscore: [d0, d1, d2, d3], img, }: Config, modes: Record<string, string>) => MwConfig;
27
+ export declare const getStaticMwConfig: ({ variable, parserFunction: [p0, p1, ...p2], protocol, nsid, functionHook, variants, redirection, ext, doubleUnderscore: [d0, d1, d2, d3], img, }: ConfigData, modes: Record<string, string>) => MwConfig;
package/dist/token.d.ts CHANGED
@@ -30,7 +30,10 @@ declare interface State extends Nesting {
30
30
  n: number;
31
31
  html: number;
32
32
  };
33
- redirect: boolean;
33
+ sof: boolean;
34
+ redirect: {
35
+ colon: boolean;
36
+ } | false;
34
37
  imgLink: boolean;
35
38
  data: MediaWikiData;
36
39
  }
@@ -63,8 +66,8 @@ export interface MwConfig extends MwConfigBase {
63
66
  implicitlyClosedHtmlTags?: string[];
64
67
  linkSuggest?: ApiSuggest;
65
68
  paramSuggest?: ApiSuggest;
66
- titleParser?: (state: EditorState, node: SyntaxNode, urlProtocols: string) => true | undefined;
67
- isbnParser?: (link: string) => true;
69
+ titleParser?: (state: EditorState, node: SyntaxNode) => string | undefined;
70
+ isbnParser?: (link: string) => string;
68
71
  }
69
72
  declare class MediaWikiData {
70
73
  /** 已解析的节点 */
@@ -86,7 +89,7 @@ export declare class MediaWiki {
86
89
  [x: string]: Tag;
87
90
  };
88
91
  readonly hiddenTable: Record<string, Tag>;
89
- readonly permittedHtmlTags: Set<string>;
92
+ readonly permittedHtmlTags: Set<string | undefined>;
90
93
  readonly implicitlyClosedHtmlTags: Set<string>;
91
94
  readonly urlProtocols: RegExp;
92
95
  readonly linkRegex: RegExp;
@@ -94,16 +97,19 @@ export declare class MediaWiki {
94
97
  readonly redirectRegex: RegExp;
95
98
  readonly img: string[];
96
99
  readonly imgRegex: RegExp;
97
- readonly headerRegex: RegExp;
98
- readonly templateRegex: RegExp;
99
- readonly argumentRegex: RegExp;
100
- readonly styleRegex: RegExp;
101
100
  readonly convertSemicolon: RegExp | undefined;
102
101
  readonly convertLang: RegExp | undefined;
103
- readonly convertRegex: RegExp;
104
- readonly wikiRegex: RegExp;
105
- readonly tableDefinitionRegex: RegExp;
106
102
  readonly tags: string[];
103
+ readonly hasVariants: boolean;
104
+ readonly preRegex: [RegExp, RegExp];
105
+ readonly autocompleteNamespaces: {
106
+ 0: string;
107
+ 6: string;
108
+ 8: string;
109
+ 10: string;
110
+ 274: string;
111
+ 828: string;
112
+ };
107
113
  constructor(config: MwConfig);
108
114
  /**
109
115
  * Dynamically register a token in CodeMirror.
@@ -145,9 +151,9 @@ export declare class MediaWiki {
145
151
  inExtTokens(origString: string): Tokenizer;
146
152
  inVariable(pos?: number): Tokenizer;
147
153
  eatTransclusion(stream: StringStream, state: State, { length }: string): string | undefined;
148
- inParserFunctionName(invoke?: number, n?: number): Tokenizer;
154
+ inParserFunctionName(invoke?: number, n?: number, ns?: number): Tokenizer;
149
155
  inTemplatePageName(haveEaten?: boolean, anchor?: boolean): Tokenizer;
150
- inParserFunctionArgument(module?: number, n?: number): Tokenizer;
156
+ inParserFunctionArgument(module?: number, n?: number, ns?: number): Tokenizer;
151
157
  inTemplateArgument(expectName?: boolean, parserFunction?: boolean): Tokenizer;
152
158
  inConvert(style: string, needFlag?: boolean, needLang?: boolean, plain?: boolean): Tokenizer;
153
159
  eatEntity(stream: StringStream, style: string): string;
@@ -159,7 +165,7 @@ export declare class MediaWiki {
159
165
  * @param tags
160
166
  */
161
167
  mediawiki(tags?: string[]): StreamParser<State>;
162
- 'text/mediawiki'(): StreamParser<State>;
168
+ 'text/mediawiki'(tags?: string[]): StreamParser<State>;
163
169
  'text/nowiki'(): StreamParser<Record<string, never>>;
164
170
  inPre(begin?: boolean): Tokenizer<string>;
165
171
  'text/pre'(): StreamParser<State>;