From 6381b61b7cfd5dc9e51362796fe4cb95b48cbc8a Mon Sep 17 00:00:00 2001 From: bhsd <2545473905@qq.com> Date: Tue, 7 May 2024 17:33:54 +0800 Subject: [PATCH 1/2] doc(README): update --- README.en.md | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.en.md b/README.en.md index 253063561..7f0a9e044 100644 --- a/README.en.md +++ b/README.en.md @@ -18,7 +18,7 @@ This version provides a [CLI](https://en.wikipedia.org/wiki/Command-line_interfa ## Browser-compatible -A browser-compatible version, which can be used for code highlighting or as a linting plugin in conjunction with the [CodeMirror](https://codemirror.net/) editor. ([Usage example](https://bhsd-harry.github.io/wikiparser-node)) +A browser-compatible version, which can be used for code highlighting or as a linting plugin in conjunction with editors such as [CodeMirror](https://codemirror.net/) and [Monaco](https://microsoft.github.io/monaco-editor/). ([Usage example](https://bhsd-harry.github.io/wikiparser-node)) # Installation diff --git a/README.md b/README.md index 005f8d35b..d25c08cef 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ WikiParser-Node 是一款由 Bhsd 开发的基于 [Node.js](https://nodejs.org/) ## Browser-compatible -兼容浏览器的版本,可用于代码高亮或是搭配 [CodeMirror](https://codemirror.net/) 编辑器作为语法分析插件。([使用实例展示](https://bhsd-harry.github.io/wikiparser-node)) +兼容浏览器的版本,可用于代码高亮或是搭配 [CodeMirror](https://codemirror.net/) 和 [Monaco](https://microsoft.github.io/monaco-editor/) 等编辑器作为语法分析插件。([使用实例展示](https://bhsd-harry.github.io/wikiparser-node)) # 安装方法 From b2ef15bd21157f88fceb51b82d3f5ef99bd18a05 Mon Sep 17 00:00:00 2001 From: bhsd <2545473905@qq.com> Date: Wed, 8 May 2024 10:07:22 +0800 Subject: [PATCH 2/2] fix(parser/commentAndExt): self-closing noinclude --- CHANGELOG.md | 1 + parser/commentAndExt.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 14d37ce9c..6d3163ffe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - Allow an external image as `ext-link-text` - Ignore duplicated parameters containing extension tags in [`TranscludeToken.prototype.lint`](https://github.com/bhsd-harry/wikiparser-node/wiki/TranscludeToken#lint) +- Self-closing tags `` and `` are now valid **Changed** diff --git a/parser/commentAndExt.ts b/parser/commentAndExt.ts index 403c67d96..35d3eb318 100644 --- a/parser/commentAndExt.ts +++ b/parser/commentAndExt.ts @@ -55,7 +55,7 @@ export const parseCommentAndExt = (wikitext: string, config: Config, accum: Toke } } /* eslint-disable @typescript-eslint/no-unused-expressions */ - /]*)?>|<\/foo\s*>/giu; + /]*)?\/?>|<\/foo\s*>/giu; /<(bar)(\s[^>]*?)?(?:\/>|>(.*?)<\/(\1\s*)>)/gisu; /<(baz)(\s[^>]*?)?(?:\/>|>(.*?)(?:<\/(baz\s*)>|$))/gisu; /* eslint-enable @typescript-eslint/no-unused-expressions */ @@ -65,7 +65,7 @@ export const parseCommentAndExt = (wikitext: string, config: Config, accum: Toke regex = new RegExp( '|$)' // comment + '|' - + `<${noincludeRegex}(?:\\s[^>]*)?>|` // + + `<${noincludeRegex}(?:\\s[^>]*)?/?>|` // + '|' + `<(${ext})(\\s[^>]*?)?(?:/>|>(.*?))` // 扩展标签 + '|'