@bhsd/codemirror-mediawiki 2.25.6 → 2.27.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
@@ -586,24 +586,29 @@ CTRL/CMD-click opens a link in a new tab.
586
586
  ### Extension
587
587
 
588
588
  1. [Extension:Translate](https://www.mediawiki.org/wiki/Extension:Translate) is not supported.
589
+ 1. [Extension:Poem](https://www.mediawiki.org/wiki/Extension:Poem) should prevent preformatted text ([Example](http://bhsd-harry.github.io/monaco-wiki/tests.html#%3Cpoem%3E%20with%20leading%20whitespace)).
589
590
 
590
591
  ### Transclusion
591
592
 
592
- 1. Non-existing parser functions starting with `#` are highlighted ([Example](http://bhsd-harry.github.io/codemirror-mediawiki/tests.html#Parsoid%3A%20unknown%20parser%20function%20(T314524))).
593
+ 1. Substitution is not correctly highlighted ([Example](http://bhsd-harry.github.io/monaco-wiki/tests.html#Scribunto%3A%20isSubsting%20during%20PST)).
594
+ 1. Non-existing parser functions starting with `#` are highlighted as parser functions ([Example](http://bhsd-harry.github.io/codemirror-mediawiki/tests.html#Parsoid%3A%20unknown%20parser%20function%20(T314524))).
593
595
  1. Wikitext in template parameter names is not highlighted ([Example](http://bhsd-harry.github.io/codemirror-mediawiki/tests.html#Templates%3A%20Other%20wikitext%20in%20parameter%20names%20(T69657))).
594
596
  1. Template parameter names followed by a newline are not recognized ([Example](http://bhsd-harry.github.io/codemirror-mediawiki/tests.html#Templates%3A%20Handle%20comments%20in%20parameter%20names%20(T69657))).
595
597
 
596
- ### Link
598
+ ### Heading
597
599
 
598
- 1. Nested double brackets are highlighted incorrectly ([Example](http://bhsd-harry.github.io/codemirror-mediawiki/tests.html#Non-wikilinks%20should%20not%20be%20treated%20as%20broken%20wikilinks)).
599
- 1. Double URI encoding should not appear in link targets ([Example](http://bhsd-harry.github.io/codemirror-mediawiki/tests.html#Link%20containing%20%25%20as%20a%20double%20hex%20sequence%20interpreted%20to%20hex%20sequence)).
600
- 1. Double HTML escaping should not appear in link targets ([Example](http://bhsd-harry.github.io/codemirror-mediawiki/tests.html#Link%20containing%20an%20ampersand)).
600
+ 1. Comments at the SOL break section headings ([Example](https://bhsd-harry.github.io/codemirror-mediawiki/tests.html#Section%20extraction%20prefixed%20by%20comment%20(section%201))).
601
+
602
+ ### Table
603
+
604
+ 1. Comments at the SOL break table syntax ([Example](https://bhsd-harry.github.io/codemirror-mediawiki/tests.html#3c.%20Table%20cells%20without%20escapable%20prefixes%20after%20edits)).
601
605
 
602
606
  ### External link
603
607
 
608
+ 1. IPv6 addresses are not supported ([Example](http://bhsd-harry.github.io/codemirror-mediawiki/tests.html#IPv6%20urls%2C%20autolink%20format%20(T23261))).
604
609
  1. External links inside double brackets are highlighted incorrectly ([Example](http://bhsd-harry.github.io/codemirror-mediawiki/tests.html#Render%20invalid%20page%20names%20as%20plain%20text%20(T53090))).
605
610
 
606
611
  ### Block element
607
612
 
608
613
  1. Comments at the SOL break the highlighting ([Example](https://bhsd-harry.github.io/codemirror-mediawiki/tests.html#1.%20Lists%20with%20start-of-line-transparent%20tokens%20before%20bullets%3A%20Comments)).
609
- 1. False positives of preformatted text when there are categories ([Example](http://bhsd-harry.github.io/codemirror-mediawiki/tests.html#Category%20%2F%20paragraph%20interactions)).
614
+ 1. False positives of preformatted text when there are categories ([Example](http://bhsd-harry.github.io/codemirror-mediawiki/tests.html#Category%20%2F%20paragraph%20interactions)) or HTML tags ([Example](http://bhsd-harry.github.io/codemirror-mediawiki/tests.html#Parsing%20optional%20HTML%20elements%20(T8171))).
package/dist/config.d.ts CHANGED
@@ -43,6 +43,7 @@ tokens: {
43
43
  extTagAttributeValue: string;
44
44
  extTagBracket: string;
45
45
  extTagName: string;
46
+ fileDelimiter: string;
46
47
  fileText: string;
47
48
  freeExtLink: string;
48
49
  freeExtLinkProtocol: string;
package/dist/css.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import type { Extension } from '@codemirror/state';
2
+ declare const _default: () => Extension;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { Extension } from '@codemirror/state';
2
+ declare const _default: () => Extension;
3
+ export default _default;
@@ -0,0 +1,15 @@
1
+ export interface KeymapConfig {
2
+ key: string;
3
+ desc: string;
4
+ pre?: string;
5
+ post?: string;
6
+ splitlines?: boolean;
7
+ }
8
+ export declare const keybindings: KeymapConfig[];
9
+ /**
10
+ * 将文本各行包裹在指定的前后缀中
11
+ * @param text 跨行文本
12
+ * @param pre 前缀
13
+ * @param post 后缀
14
+ */
15
+ export declare const encapsulateLines: (text: string, pre: string, post: string) => string;
@@ -0,0 +1,15 @@
1
+ export interface KeymapConfig {
2
+ key: string;
3
+ desc: string;
4
+ pre?: string;
5
+ post?: string;
6
+ splitlines?: boolean;
7
+ }
8
+ export declare const keybindings: KeymapConfig[];
9
+ /**
10
+ * 将文本各行包裹在指定的前后缀中
11
+ * @param text 跨行文本
12
+ * @param pre 前缀
13
+ * @param post 后缀
14
+ */
15
+ export declare const encapsulateLines: (text: string, pre: string, post: string) => string;
@@ -0,0 +1,34 @@
1
+ const keybindings = [
2
+ { key: "Ctrl-8", pre: "<blockquote>", post: "</blockquote>", desc: "blockquote" },
3
+ { key: "Mod-.", pre: "<sup>", post: "</sup>", desc: "sup" },
4
+ { key: "Mod-,", pre: "<sub>", post: "</sub>", desc: "sub" },
5
+ { key: "Mod-Shift-6", pre: "<code>", post: "</code>", desc: "code" },
6
+ { key: "Ctrl-Shift-5", pre: "<s>", post: "</s>", desc: "s" },
7
+ { key: "Mod-u", pre: "<u>", post: "</u>", desc: "u" },
8
+ { key: "Mod-k", pre: "[[", post: "]]", desc: "link" },
9
+ { key: "Mod-i", pre: "''", post: "''", desc: "italic" },
10
+ { key: "Mod-b", pre: "'''", post: "'''", desc: "bold" },
11
+ { key: "Mod-Shift-k", pre: "<ref>", post: "</ref>", desc: "ref" },
12
+ { key: "Mod-/", pre: "<!-- ", post: " -->", desc: "comment" },
13
+ { key: "Ctrl-0", splitlines: true, desc: "heading 0" },
14
+ ...new Array(6).fill(0).map((_, i) => ({
15
+ key: `Ctrl-${i + 1}`,
16
+ pre: `${"=".repeat(i + 1)} `,
17
+ post: ` ${"=".repeat(i + 1)}`,
18
+ splitlines: true,
19
+ desc: `heading ${i + 1}`
20
+ })),
21
+ { key: "Ctrl-7", pre: " ", splitlines: true, desc: "pre" }
22
+ ];
23
+ const encapsulateLines = (text, pre, post) => {
24
+ const lines = text.split("\n");
25
+ return lines.map((line) => {
26
+ var _a, _b;
27
+ const str = ((_b = (_a = /^(={1,6})(.+)\1$/u.exec(line)) == null ? void 0 : _a[2]) != null ? _b : line).trim();
28
+ return pre === " " || lines.length === 1 || line.trim() ? pre + str + post : str;
29
+ }).join("\n");
30
+ };
31
+ export {
32
+ encapsulateLines,
33
+ keybindings
34
+ };
package/dist/lua.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import type { Extension } from '@codemirror/state';
2
+ declare const _default: () => Extension;
3
+ export default _default;