wikiparser-node 1.29.2 → 1.31.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.
Files changed (107) hide show
  1. package/README.md +8 -4
  2. package/bundle/bundle-es8.min.js +29 -26
  3. package/bundle/bundle-lsp.min.js +34 -31
  4. package/bundle/bundle.min.js +22 -22
  5. package/dist/addon/magicWords.js +642 -40
  6. package/dist/addon/token.js +99 -111
  7. package/dist/addon/transclude.js +2 -2
  8. package/dist/base.d.mts +4 -3
  9. package/dist/base.d.ts +4 -3
  10. package/dist/base.js +3 -0
  11. package/dist/base.mjs +3 -0
  12. package/dist/bin/config.js +1 -1
  13. package/dist/index.d.ts +11 -1
  14. package/dist/index.js +47 -15
  15. package/dist/internal.d.ts +2 -1
  16. package/dist/lib/attributes.js +0 -1
  17. package/dist/lib/document.js +2 -2
  18. package/dist/lib/element.d.ts +1 -1
  19. package/dist/lib/element.js +9 -7
  20. package/dist/lib/lintConfig.js +12 -1
  21. package/dist/lib/lsp.d.ts +0 -1
  22. package/dist/lib/lsp.js +2 -5
  23. package/dist/lib/node.js +7 -9
  24. package/dist/lib/redirectMap.js +1 -1
  25. package/dist/lib/text.js +68 -22
  26. package/dist/lib/title.js +1 -1
  27. package/dist/mixin/attributesParent.d.ts +0 -1
  28. package/dist/mixin/attributesParent.js +2 -4
  29. package/dist/mixin/elementLike.js +2 -4
  30. package/dist/mixin/fixed.js +0 -2
  31. package/dist/mixin/gapped.js +0 -2
  32. package/dist/mixin/hidden.js +1 -3
  33. package/dist/mixin/noEscape.js +1 -3
  34. package/dist/mixin/nodeLike.js +2 -4
  35. package/dist/mixin/padded.js +5 -9
  36. package/dist/mixin/singleLine.js +0 -2
  37. package/dist/mixin/sol.js +0 -2
  38. package/dist/mixin/syntax.js +0 -2
  39. package/dist/parser/commentAndExt.js +1 -1
  40. package/dist/parser/hrAndDoubleUnderscore.js +11 -9
  41. package/dist/parser/quotes.js +20 -8
  42. package/dist/parser/table.js +1 -2
  43. package/dist/src/arg.js +10 -5
  44. package/dist/src/atom.js +2 -0
  45. package/dist/src/attribute.js +12 -12
  46. package/dist/src/attributes.js +6 -5
  47. package/dist/src/commented.js +0 -1
  48. package/dist/src/converterFlags.js +1 -1
  49. package/dist/src/converterRule.js +1 -2
  50. package/dist/src/extLink.js +2 -2
  51. package/dist/src/heading.d.ts +8 -0
  52. package/dist/src/heading.js +25 -2
  53. package/dist/src/imageParameter.js +6 -7
  54. package/dist/src/index.d.ts +0 -2
  55. package/dist/src/index.js +5 -9
  56. package/dist/src/link/base.js +13 -6
  57. package/dist/src/link/category.d.ts +1 -1
  58. package/dist/src/link/category.js +5 -3
  59. package/dist/src/link/file.js +9 -9
  60. package/dist/src/link/galleryImage.d.ts +0 -2
  61. package/dist/src/link/galleryImage.js +2 -4
  62. package/dist/src/link/index.js +4 -4
  63. package/dist/src/link/redirectTarget.js +1 -1
  64. package/dist/src/magicLink.js +3 -3
  65. package/dist/src/multiLine/gallery.js +5 -5
  66. package/dist/src/multiLine/imagemap.js +1 -1
  67. package/dist/src/multiLine/paramTag.js +1 -1
  68. package/dist/src/nested.js +1 -1
  69. package/dist/src/nowiki/comment.js +1 -1
  70. package/dist/src/nowiki/dd.d.ts +3 -0
  71. package/dist/src/nowiki/doubleUnderscore.d.ts +3 -0
  72. package/dist/src/nowiki/hr.d.ts +3 -0
  73. package/dist/src/nowiki/index.js +3 -3
  74. package/dist/src/nowiki/list.d.ts +5 -0
  75. package/dist/src/nowiki/list.js +32 -0
  76. package/dist/src/nowiki/listBase.js +2 -2
  77. package/dist/src/nowiki/noinclude.d.ts +2 -1
  78. package/dist/src/nowiki/noinclude.js +26 -1
  79. package/dist/src/nowiki/quote.d.ts +21 -0
  80. package/dist/src/nowiki/quote.js +61 -4
  81. package/dist/src/paramLine.js +2 -0
  82. package/dist/src/parameter.js +3 -3
  83. package/dist/src/pre.js +1 -1
  84. package/dist/src/redirect.js +1 -1
  85. package/dist/src/syntax.js +1 -1
  86. package/dist/src/table/base.js +2 -3
  87. package/dist/src/table/index.d.ts +1 -5
  88. package/dist/src/table/index.js +8 -10
  89. package/dist/src/table/td.js +11 -12
  90. package/dist/src/table/trBase.js +2 -4
  91. package/dist/src/tag/html.js +4 -5
  92. package/dist/src/tag/index.js +9 -8
  93. package/dist/src/tagPair/ext.js +7 -6
  94. package/dist/src/tagPair/include.js +1 -1
  95. package/dist/src/tagPair/translate.d.ts +1 -0
  96. package/dist/src/tagPair/translate.js +8 -1
  97. package/dist/src/transclude.d.ts +6 -6
  98. package/dist/src/transclude.js +25 -18
  99. package/dist/util/constants.js +4 -2
  100. package/dist/util/html.js +11 -5
  101. package/dist/util/string.js +22 -10
  102. package/extensions/dist/base.js +3 -3
  103. package/extensions/editor.css +1 -1
  104. package/i18n/en.json +3 -0
  105. package/i18n/zh-hans.json +3 -0
  106. package/i18n/zh-hant.json +3 -0
  107. package/package.json +34 -29
@@ -37,7 +37,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
37
37
  return (mod && mod.__esModule) ? mod : { "default": mod };
38
38
  };
39
39
  Object.defineProperty(exports, "__esModule", { value: true });
40
- exports.TranscludeToken = void 0;
40
+ exports.TranscludeToken = exports.getCanonicalName = void 0;
41
41
  const string_1 = require("../util/string");
42
42
  const lint_1 = require("../util/lint");
43
43
  const debug_1 = require("../util/debug");
@@ -54,6 +54,23 @@ const syntax_1 = require("./syntax");
54
54
  const cached_1 = require("../mixin/cached");
55
55
  const basicMagicWords = new Map([['=', '='], ['!', '|']]);
56
56
  /* NOT FOR BROWSER END */
57
+ /**
58
+ * 获取魔术字的规范名称
59
+ * @param name 魔术字
60
+ * @param parserFunction 解析设置中的parserFunction属性
61
+ */
62
+ const getCanonicalName = (name, parserFunction) => {
63
+ const lcName = name.toLowerCase(), [insensitive, sensitive] = parserFunction, isOldSchema = Array.isArray(sensitive), isSensitive = isOldSchema ? sensitive.includes(name) : Object.prototype.hasOwnProperty.call(sensitive, name);
64
+ return [
65
+ lcName,
66
+ isOldSchema,
67
+ isSensitive,
68
+ !isOldSchema && isSensitive
69
+ ? sensitive[name]
70
+ : Object.prototype.hasOwnProperty.call(insensitive, lcName) && insensitive[lcName],
71
+ ];
72
+ };
73
+ exports.getCanonicalName = getCanonicalName;
57
74
  /**
58
75
  * template or magic word
59
76
  *
@@ -98,7 +115,6 @@ let TranscludeToken = (() => {
98
115
  * @since v1.21.0
99
116
  */
100
117
  get module() {
101
- // eslint-disable-next-line no-unused-labels
102
118
  LSP: return this.type === 'magic-word' && this.name === 'invoke' ? this.#getTitle().title : undefined;
103
119
  }
104
120
  /**
@@ -108,7 +124,7 @@ let TranscludeToken = (() => {
108
124
  * @since v1.21.2
109
125
  */
110
126
  get function() {
111
- LSP: return this.type === 'magic-word' && this.name === 'invoke' // eslint-disable-line no-unused-labels
127
+ LSP: return this.type === 'magic-word' && this.name === 'invoke'
112
128
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
113
129
  ? this.childNodes[2]?.text().trim()
114
130
  : undefined;
@@ -139,7 +155,7 @@ let TranscludeToken = (() => {
139
155
  super(undefined, config, accum, {
140
156
  AtomToken: 0, SyntaxToken: 0, ParameterToken: '1:',
141
157
  });
142
- const { parserFunction: [insensitive, sensitive], variable, functionHook } = config, argSubst = /^(?:\s|\0\d+[cn]\x7F)*\0\d+s\x7F/u.exec(title)?.[0];
158
+ const { parserFunction, variable, functionHook } = config, argSubst = /^(?:\s|\0\d+[cn]\x7F)*\0\d+s\x7F/u.exec(title)?.[0];
143
159
  if (argSubst) {
144
160
  this.setAttribute('modifier', argSubst);
145
161
  title = title.slice(argSubst.length);
@@ -154,11 +170,7 @@ let TranscludeToken = (() => {
154
170
  if (isFunction || parts.length === 0 && !this.#raw) {
155
171
  const magicWord = isFunction ? title.slice(0, colon) : title, arg = isFunction && title.slice(colon + 1), cleaned = (0, string_1.removeComment)(magicWord), name = isFunction
156
172
  ? cleaned.slice(cleaned.search(/\S/u)) + (fullWidth ? ':' : '')
157
- : cleaned.trim(), lcName = name.toLowerCase(), isOldSchema = Array.isArray(sensitive), isSensitive = isOldSchema
158
- ? sensitive.includes(name)
159
- : Object.prototype.hasOwnProperty.call(sensitive, name), canonicalName = !isOldSchema && isSensitive
160
- ? sensitive[name]
161
- : Object.prototype.hasOwnProperty.call(insensitive, lcName) && insensitive[lcName], isFunc = isOldSchema && isSensitive
173
+ : cleaned.trim(), [lcName, isOldSchema, isSensitive, canonicalName] = (0, exports.getCanonicalName)(name, parserFunction), isFunc = isOldSchema && isSensitive
162
174
  || !('functionHook' in config) || functionHook.includes(canonicalName), isVar = isOldSchema && isSensitive || variable.includes(canonicalName);
163
175
  if (isFunction ? canonicalName && isFunc : isVar) {
164
176
  this.setAttribute('name', canonicalName || lcName.replace(/^#|:$/u, ''));
@@ -348,7 +360,7 @@ let TranscludeToken = (() => {
348
360
  }
349
361
  /** @private */
350
362
  lint(start = this.getAbsoluteIndex(), re) {
351
- LINT: { // eslint-disable-line no-unused-labels
363
+ LINT: {
352
364
  const errors = super.lint(start, re);
353
365
  if (!this.isTemplate()) {
354
366
  return errors;
@@ -495,10 +507,11 @@ let TranscludeToken = (() => {
495
507
  * @throws `Error` 仅用于模板
496
508
  */
497
509
  getDuplicatedArgs() {
498
- LINT: { // eslint-disable-line no-unused-labels
510
+ LINT: {
499
511
  if (this.isTemplate()) {
500
512
  return [...this.#args].filter(([, { size }]) => size > 1).map(([key, args]) => [key, [...args]]);
501
513
  }
514
+ /* NOT FOR BROWSER */
502
515
  throw new Error('TranscludeToken.getDuplicatedArgs method is only for template!');
503
516
  }
504
517
  }
@@ -541,7 +554,7 @@ let TranscludeToken = (() => {
541
554
  if (length === 0) {
542
555
  queue.splice(i, 1);
543
556
  }
544
- else if (length > 1 || first.type !== 'magic-word') {
557
+ else if (length > 1 || !first.is('magic-word')) {
545
558
  i++;
546
559
  }
547
560
  else {
@@ -702,7 +715,6 @@ let TranscludeToken = (() => {
702
715
  * @param key parameter name / 参数名
703
716
  * @param value parameter value / 参数值
704
717
  * @param newline whether to append the new parameter on a new line / 是否在添加参数时另起一行
705
- * @throws `Error` 仅用于模板
706
718
  */
707
719
  setValue(key, value, newline) {
708
720
  require('../addon/transclude');
@@ -727,7 +739,6 @@ let TranscludeToken = (() => {
727
739
  *
728
740
  * 替换模板名
729
741
  * @param title template name / 模板名
730
- * @throws `Error` 仅用于模板
731
742
  */
732
743
  replaceTemplate(title) {
733
744
  require('../addon/transclude');
@@ -738,7 +749,6 @@ let TranscludeToken = (() => {
738
749
  *
739
750
  * 替换模块名
740
751
  * @param title module name / 模块名
741
- * @throws `Error` 仅用于模块
742
752
  */
743
753
  replaceModule(title) {
744
754
  require('../addon/transclude');
@@ -749,8 +759,6 @@ let TranscludeToken = (() => {
749
759
  *
750
760
  * 替换模块函数
751
761
  * @param func module function name / 模块函数名
752
- * @throws `Error` 仅用于模块
753
- * @throws `Error` 尚未指定模块名称
754
762
  */
755
763
  replaceFunction(func) {
756
764
  require('../addon/transclude');
@@ -789,7 +797,6 @@ let TranscludeToken = (() => {
789
797
  * Escape tables inside the template
790
798
  *
791
799
  * 转义模板内的表格
792
- * @throws `Error` 转义失败
793
800
  */
794
801
  escapeTables() {
795
802
  require('../addon/transclude');
@@ -9,8 +9,10 @@ var BuildMethod;
9
9
  BuildMethod[BuildMethod["String"] = 0] = "String";
10
10
  BuildMethod[BuildMethod["Text"] = 1] = "Text";
11
11
  })(BuildMethod || (exports.BuildMethod = BuildMethod = {}));
12
- // eslint-disable-next-line n/no-missing-require
13
- exports.enMsg = (() => require('../../i18n/en.json'))();
12
+ exports.enMsg = (() => {
13
+ // eslint-disable-next-line n/no-missing-require
14
+ LSP: return require('../../i18n/en.json');
15
+ })();
14
16
  /* NOT FOR BROWSER ONLY */
15
17
  exports.mathTags = new Set(['math', 'chem', 'ce']);
16
18
  /* NOT FOR BROWSER ONLY END */
package/dist/util/html.js CHANGED
@@ -9,9 +9,7 @@ const string_1 = require("./string");
9
9
  * @param prefix
10
10
  * @param lastPrefix
11
11
  */
12
- const getCommon = (prefix, lastPrefix) =>
13
- // eslint-disable-next-line @typescript-eslint/no-misused-spread
14
- prefix.startsWith(lastPrefix) ? lastPrefix.length : [...lastPrefix].findIndex((ch, i) => ch !== prefix[i]);
12
+ const getCommon = (prefix, lastPrefix) => prefix.startsWith(lastPrefix) ? lastPrefix.length : [...lastPrefix].findIndex((ch, i) => ch !== prefix[i]);
15
13
  exports.getCommon = getCommon;
16
14
  /**
17
15
  * get next list item
@@ -95,7 +93,7 @@ const html = (childNodes, separator, opt) => {
95
93
  if ((child.length > 0 || /\s$/u.test(innerText))
96
94
  && previousSibling.is('list')
97
95
  && !/[;#*]/u.test(innerText)
98
- && child.closest('ext#poem,list-range')?.is('ext')) {
96
+ && child.closest('ext-inner#poem,list-range')?.type === 'ext-inner') {
99
97
  lastPrefix = '';
100
98
  result = `<span style="display: inline-block; margin-inline-start: ${previousSibling.indent}em;">${result}</span>`;
101
99
  }
@@ -145,7 +143,15 @@ exports.html = html;
145
143
  * @param tokens inner tokens of a section heading
146
144
  */
147
145
  const getId = (tokens) => {
148
- const opt = { nocc: true }, content = Array.isArray(tokens) ? (0, exports.html)(tokens, '', opt) : tokens.toHtmlInternal(opt), id = (0, string_1.decodeHtml)((0, string_1.sanitizeAlt)(content.replaceAll('_', ' ')))
146
+ let content;
147
+ if (typeof tokens === 'string') {
148
+ content = tokens;
149
+ }
150
+ else {
151
+ const opt = { nocc: true };
152
+ content = Array.isArray(tokens) ? (0, exports.html)(tokens, '', opt) : tokens.toHtmlInternal(opt);
153
+ }
154
+ const id = (0, string_1.decodeHtml)((0, string_1.sanitizeAlt)(content.replaceAll('_', ' ')))
149
155
  .replace(/[\s_]+/gu, '_');
150
156
  return id.endsWith('_') ? id.slice(0, -1) : id;
151
157
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.removeCommentLine = exports.newline = exports.sanitizeAlt = exports.sanitizeId = exports.sanitizeAttr = exports.sanitize = exports.normalizeSpace = exports.encode = exports.noWrap = exports.escapeRegExp = exports.print = exports.escape = exports.decodeNumber = exports.decodeHtml = exports.decodeHtmlBasic = exports.text = exports.removeComment = exports.tidy = exports.trimLc = exports.extUrlChar = exports.extUrlCharFirst = exports.zs = void 0;
3
+ exports.removeCommentLine = exports.newline = exports.sanitizeAlt = exports.sanitizeId = exports.sanitizeAttr = exports.sanitize = exports.normalizeSpace = exports.encode = exports.noWrap = exports.escapeRegExp = exports.print = exports.escape = exports.replaceEntities = exports.decodeNumber = exports.decodeHtml = exports.decodeHtmlBasic = exports.text = exports.removeComment = exports.tidy = exports.trimLc = exports.extUrlChar = exports.extUrlCharFirst = exports.zs = void 0;
4
4
  exports.restore = restore;
5
5
  exports.zs = String.raw ` \xA0\u1680\u2000-\u200A\u202F\u205F\u3000`;
6
6
  const commonExtUrlChar = String.raw `[^[\]<>"\0-\x1F\x7F${exports.zs}\uFFFD]`;
@@ -57,22 +57,35 @@ const decodeHtml = (str) => {
57
57
  }
58
58
  catch { }
59
59
  }
60
- /* istanbul ignore next */
61
60
  /* NOT FOR BROWSER ONLY END */
61
+ /* istanbul ignore next */
62
62
  return (0, exports.decodeHtmlBasic)(str);
63
63
  };
64
64
  exports.decodeHtml = decodeHtml;
65
65
  /** decode numbered HTML entities */
66
66
  exports.decodeNumber = factory(/&#(\d+|x[\da-f]+);/giu, (_, code) => String.fromCodePoint(Number((/^x/iu.test(code) ? '0' : '') + code)));
67
67
  /* PRINT ONLY */
68
- const entities = { '&': 'amp', '<': 'lt', '>': 'gt', '"': 'quot', '\n': '#10' };
68
+ const entities = {
69
+ '&': 'amp',
70
+ '<': 'lt',
71
+ '>': 'gt',
72
+ '"': 'quot',
73
+ '\n': '#10',
74
+ /* NOT FOR BROWSER */
75
+ '{': '#123',
76
+ '}': '#125',
77
+ '[': '#91',
78
+ ']': '#93',
79
+ '|': '#124',
80
+ };
69
81
  /**
70
82
  * replace by HTML entities
71
83
  * @param re regex
72
84
  */
73
- const replaceEntities = (re) => factory(re, p => `&${entities[p]};`);
85
+ const replaceEntities = (re = /[&<>"{}[\]|]/gu) => factory(re, p => `&${entities[p]};`);
86
+ exports.replaceEntities = replaceEntities;
74
87
  /** escape HTML entities */
75
- exports.escape = replaceEntities(/[&<>]/gu);
88
+ exports.escape = (0, exports.replaceEntities)(/[&<>]/gu);
76
89
  /**
77
90
  * 以HTML格式打印
78
91
  * @param childNodes 子节点
@@ -106,8 +119,8 @@ const normalizeSpace = (token) => {
106
119
  };
107
120
  exports.normalizeSpace = normalizeSpace;
108
121
  /** escape HTML entities */
109
- exports.sanitize = replaceEntities(/[<>]|&(?=amp(?!;))/giu);
110
- const replaceAttrEntities = replaceEntities(/[<>"]/gu);
122
+ exports.sanitize = (0, exports.replaceEntities)(/[<>]|&(?=amp(?!;))/giu);
123
+ const replaceAttrEntities = (0, exports.replaceEntities)(/[<>"]/gu);
111
124
  /**
112
125
  * escape HTML entities in attributes
113
126
  * @param attr 属性值
@@ -116,14 +129,13 @@ const replaceAttrEntities = replaceEntities(/[<>"]/gu);
116
129
  const sanitizeAttr = (attr, id) => replaceAttrEntities(attr.replace(/\s+|&#10;/gu, id ? '_' : ' '));
117
130
  exports.sanitizeAttr = sanitizeAttr;
118
131
  /** escape HTML entities in heading id */
119
- exports.sanitizeId = replaceEntities(/["&]/gu);
132
+ exports.sanitizeId = (0, exports.replaceEntities)(/["<>&]/gu);
120
133
  /**
121
134
  * sanitize selected HTML attributes
122
135
  * @param str attribute value
123
136
  */
124
137
  const sanitizeAlt = (str) => str?.replace(/<\/?[a-z].*?>/gu, '').trim()
125
- .replace(/\s+/gu, ' ')
126
- .replaceAll('"', '&quot;');
138
+ .replace(/\s+|"/gu, m => m === '"' ? '&quot;' : ' ');
127
139
  exports.sanitizeAlt = sanitizeAlt;
128
140
  /** escape newline */
129
141
  exports.newline = factory(/\n/gu, '&#10;');
@@ -1,6 +1,6 @@
1
1
  (() => {
2
2
  var _a;
3
- const version = '1.29.2', src = (_a = document.currentScript) === null || _a === void 0 ? void 0 : _a.src, file = /\/extensions\/dist\/base\.(?:min\.)?js$/u, CDN = src && file.test(src)
3
+ const version = '1.31.0', src = (_a = document.currentScript) === null || _a === void 0 ? void 0 : _a.src, file = /\/extensions\/dist\/base\.(?:min\.)?js$/u, CDN = src && file.test(src)
4
4
  ? src.replace(file, '')
5
5
  : `https://testingcf.jsdelivr.net/npm/wikiparser-node@${version}`;
6
6
  const workerJS = () => {
@@ -265,7 +265,7 @@ const splitNewLine = (html) => {
265
265
  const result = [cur];
266
266
  for (const child of html.childNodes) {
267
267
  const { textContent } = child;
268
- if (!(textContent === null || textContent === void 0 ? void 0 : textContent.includes('\n'))) {
268
+ if (!textContent.includes('\n')) {
269
269
  cur.append(child.cloneNode(true));
270
270
  continue;
271
271
  }
@@ -296,7 +296,7 @@ const size = (html) => {
296
296
  if (isContentEditable) {
297
297
  gutter.style.minHeight = `${clientHeight + 1}px`;
298
298
  }
299
- const sizer = document.createElement('span'), { style: { paddingLeft, paddingRight } } = html;
299
+ const sizer = document.createElement('span'), { paddingLeft, paddingRight } = html.style;
300
300
  sizer.className = 'wikiparser-sizer';
301
301
  sizer.style.paddingLeft = paddingLeft;
302
302
  sizer.style.paddingRight = paddingRight;
@@ -12,7 +12,7 @@
12
12
  position: absolute;
13
13
  inset: 0;
14
14
  -webkit-user-select: none;
15
- user-select: none; /* stylelint-disable-line plugin/use-baseline */
15
+ user-select: none;
16
16
  }
17
17
  #wikiPretty + .wikiparsed, #wikiPretty {
18
18
  outline: none;
package/i18n/en.json CHANGED
@@ -1,4 +1,5 @@
1
1
  {
2
+ "argument-in-ext": "template argument inside an extension tag",
2
3
  "attributes-of-closing-tag": "attributes of a closing tag",
3
4
  "bold-apostrophes": "bold apostrophes",
4
5
  "bold-in-header": "bold text in a section header",
@@ -22,6 +23,7 @@
22
23
  "frame": null,
23
24
  "full-width-punctuation": "full-width punctuation",
24
25
  "header-in-html": "section header in HTML tag attributes",
26
+ "header-like": "header-like syntax in plain text",
25
27
  "horizontal-alignment": null,
26
28
  "html-in-table": "HTML tag in table attributes",
27
29
  "illegal-attribute-name": "invalid attribute name",
@@ -59,6 +61,7 @@
59
61
  "prefix": null,
60
62
  "pipe-in-link": "additional \"|\" in the link text",
61
63
  "pipe-in-table": "additional \"|\" in a table cell",
64
+ "redirect-like": "redirect-like syntax in a list item",
62
65
  "ref-in-link": "<ref> in an internal or external link",
63
66
  "remove": null,
64
67
  "template-in-link": "template in an internal link target",
package/i18n/zh-hans.json CHANGED
@@ -1,4 +1,5 @@
1
1
  {
2
+ "argument-in-ext": "扩展标签内的模板参数",
2
3
  "attributes-of-closing-tag": "闭合标签的属性",
3
4
  "bold-apostrophes": "粗体单引号",
4
5
  "bold-in-header": "章节标题中的粗体文本",
@@ -22,6 +23,7 @@
22
23
  "frame": "框架",
23
24
  "full-width-punctuation": "全角标点",
24
25
  "header-in-html": "HTML标签属性中的章节标题",
26
+ "header-like": "纯文本中的疑似章节标题语法",
25
27
  "horizontal-alignment": "水平对齐",
26
28
  "html-in-table": "表格属性中的HTML标签",
27
29
  "illegal-attribute-name": "无效的属性名",
@@ -59,6 +61,7 @@
59
61
  "prefix": "前缀",
60
62
  "pipe-in-link": "链接文本中多余的\"|\"",
61
63
  "pipe-in-table": "表格单元格中多余的\"|\"",
64
+ "redirect-like": "列表项中的疑似重定向语法",
62
65
  "ref-in-link": "内链或外链中的<ref>",
63
66
  "remove": "移除",
64
67
  "template-in-link": "内链目标包含模板",
package/i18n/zh-hant.json CHANGED
@@ -1,4 +1,5 @@
1
1
  {
2
+ "argument-in-ext": "擴充標籤內的模板參數",
2
3
  "attributes-of-closing-tag": "結束標籤的屬性",
3
4
  "bold-apostrophes": "粗體撇號",
4
5
  "bold-in-header": "章節標題中的粗體文本",
@@ -22,6 +23,7 @@
22
23
  "frame": "框架",
23
24
  "full-width-punctuation": "全形標點",
24
25
  "header-in-html": "HTML標籤屬性中的章節標題",
26
+ "header-like": "純文字中的疑似章節標題語法",
25
27
  "horizontal-alignment": "水平對齊",
26
28
  "html-in-table": "表格屬性裡的HTML標籤",
27
29
  "illegal-attribute-name": "無效的屬性名稱",
@@ -59,6 +61,7 @@
59
61
  "prefix": "前綴",
60
62
  "pipe-in-link": "連結文本中多餘的\"|\"",
61
63
  "pipe-in-table": "表格儲存格中多餘的\"|\"",
64
+ "redirect-like": "列表項中的疑似重新導向語法",
62
65
  "ref-in-link": "內部或外部連結裡的<ref>",
63
66
  "remove": "移除",
64
67
  "template-in-link": "內部連結目標包含模板",
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "wikiparser-node",
3
- "version": "1.29.2",
3
+ "version": "1.31.0",
4
4
  "description": "A Node.js parser for MediaWiki markup with AST",
5
5
  "keywords": [
6
6
  "mediawiki",
7
7
  "wikitext",
8
- "parser"
8
+ "parser",
9
+ "browser"
9
10
  ],
10
11
  "homepage": "https://github.com/bhsd-harry/wikiparser-node/wiki",
11
12
  "bugs": {
@@ -48,17 +49,18 @@
48
49
  "toc": "node dist/script/toc.js",
49
50
  "prepublishOnly": "npm run build:core",
50
51
  "build:core": "bash build.sh",
51
- "build": "npm run build:core && node dist/script/parserTests.js",
52
+ "build": "npm run build:core && LC_ALL=en.UTF-8 node dist/script/parserTests.js",
52
53
  "diff": "bash diff.sh",
53
54
  "diff:stat": "f() { git diff --stat --ignore-all-space --color=always $1 $2 -- . | grep '\\.ts'; }; f",
54
- "lint:ts": "tsc --noEmit && eslint --cache .",
55
+ "lint:ts": "tsc --noEmit && eslint --cache . && eslint --no-config-lookup -c eslint.markdown.mjs wiki/*.md",
55
56
  "lint:json": "v8r -s config/.schema.json config/*.json && v8r -s data/.schema.json data/*.json && mocha dist/test/json.js",
56
- "lint": "npm run lint:ts && npm run lint:json",
57
+ "lint:md": "markdownlint-cli2 '**/*.md'",
58
+ "lint": "npm run lint:ts && npm run lint:json && npm run lint:md",
57
59
  "prof": "node dist/test/prof.js",
58
60
  "coverage": "nyc --cache-dir=./.cache/nyc npm run test:ci && node dist/script/coverage.js && open coverage/index.html",
59
61
  "test:unit": "mocha dist/test/test.js",
60
62
  "test:clonenode": "CLONENODE=1 npm run test:unit",
61
- "test:parser": "mocha dist/test/parserTests.js",
63
+ "test:parser": "LC_ALL=en.UTF-8 mocha dist/test/parserTests.js",
62
64
  "test": "npm run test:unit && npm run test:clonenode && npm run test:parser",
63
65
  "test:ci": "LSP=0 npm test",
64
66
  "test:end": "pkill -x http-server",
@@ -86,41 +88,44 @@
86
88
  "optionalDependencies": {
87
89
  "chalk": "^4.1.2",
88
90
  "color-name": "^2.0.0",
89
- "entities": "^6.0.0",
90
- "mathoid-texvcjs": "^0.5.4",
91
+ "entities": "^7.0.0",
92
+ "mathoid-texvcjs": "^0.6.0",
91
93
  "stylelint": "^16.25.0",
92
- "vscode-css-languageservice": "^6.3.7",
93
- "vscode-html-languageservice": "^5.5.1",
94
- "vscode-json-languageservice": "^5.6.1"
94
+ "vscode-css-languageservice": "^6.3.8",
95
+ "vscode-html-languageservice": "^5.6.0",
96
+ "vscode-json-languageservice": "^5.6.2"
95
97
  },
96
98
  "devDependencies": {
97
- "@bhsd/code-standard": "^1.2.0",
99
+ "@bhsd/code-standard": "^1.3.1",
100
+ "@bhsd/nodejs": "^0.1.0",
98
101
  "@bhsd/test-util": "^0.2.1",
99
- "@codemirror/lint": "^6.9.0",
100
- "@stylistic/eslint-plugin": "^3.1.0",
102
+ "@codemirror/lint": "^6.9.1",
103
+ "@eslint/markdown": "7.5.1",
104
+ "@stylistic/eslint-plugin": "^5.5.0",
101
105
  "@types/color-name": "^2.0.0",
102
106
  "@types/color-rgba": "^2.1.3",
103
107
  "@types/mocha": "^10.0.10",
104
- "@types/node": "^24.0.10",
105
- "@typescript-eslint/eslint-plugin": "^8.35.1",
106
- "@typescript-eslint/parser": "^8.35.1",
107
- "codejar-async": "^4.2.7",
108
+ "@types/node": "^24.9.2",
109
+ "@typescript-eslint/eslint-plugin": "^8.46.2",
110
+ "@typescript-eslint/parser": "^8.46.2",
111
+ "codejar-async": "^4.3.0",
108
112
  "color-rgba": "^3.0.0",
109
- "esbuild": "^0.25.10",
110
- "eslint": "^8.57.1",
113
+ "diff2html-cli": "^5.2.15",
114
+ "esbuild": "^0.25.11",
115
+ "eslint": "^9.38.0",
111
116
  "eslint-plugin-eslint-comments": "^3.2.0",
112
- "eslint-plugin-jsdoc": "^54.1.1",
113
- "eslint-plugin-json-es": "^1.6.0",
114
- "eslint-plugin-markdown": "5.1.0",
115
- "eslint-plugin-n": "^17.20.0",
117
+ "eslint-plugin-jsdoc": "^61.1.11",
118
+ "eslint-plugin-jsonc": "^2.21.0",
119
+ "eslint-plugin-n": "^17.23.1",
116
120
  "eslint-plugin-promise": "^7.2.1",
117
- "eslint-plugin-regexp": "^2.9.0",
118
- "eslint-plugin-unicorn": "^56.0.1",
119
- "mocha": "^11.7.1",
121
+ "eslint-plugin-regexp": "^2.10.0",
122
+ "eslint-plugin-unicorn": "^62.0.0",
123
+ "markdownlint-cli2": "^0.18.1",
124
+ "mocha": "^11.7.4",
120
125
  "monaco-editor": "^0.53.0",
121
126
  "nyc": "^17.1.0",
122
- "typescript": "^5.8.2",
123
- "v8r": "^5.0.0",
127
+ "typescript": "^5.9.3",
128
+ "v8r": "^5.1.0",
124
129
  "vscode-languageserver-textdocument": "^1.0.12"
125
130
  },
126
131
  "engines": {