wikiparser-node 1.37.1 → 1.39.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 (49) hide show
  1. package/README.md +8 -8
  2. package/bundle/bundle-es8.min.js +23 -23
  3. package/bundle/bundle-lsp.min.js +26 -26
  4. package/bundle/bundle.min.js +21 -21
  5. package/dist/addon/attribute.js +2 -2
  6. package/dist/addon/link.js +3 -4
  7. package/dist/addon/table.js +2 -2
  8. package/dist/base.d.mts +4 -3
  9. package/dist/base.d.ts +4 -3
  10. package/dist/base.js +1 -0
  11. package/dist/base.mjs +1 -0
  12. package/dist/bin/config.js +5 -4
  13. package/{extensions → dist/extensions}/typings.d.ts +2 -1
  14. package/dist/index.js +8 -7
  15. package/dist/lib/lintConfig.js +6 -3
  16. package/dist/lib/lsp.d.ts +3 -1
  17. package/dist/lib/lsp.js +24 -17
  18. package/dist/lib/ranges.js +3 -0
  19. package/dist/lib/title.d.ts +9 -2
  20. package/dist/lib/title.js +32 -14
  21. package/dist/mixin/elementLike.d.ts +2 -2
  22. package/dist/parser/hrAndDoubleUnderscore.js +1 -1
  23. package/dist/parser/table.js +1 -1
  24. package/dist/render/magicWords.js +14 -10
  25. package/dist/render/syntaxhighlight.js +12 -8
  26. package/dist/src/attribute.js +1 -1
  27. package/dist/src/index.js +3 -3
  28. package/dist/src/link/base.d.ts +3 -2
  29. package/dist/src/link/base.js +3 -4
  30. package/dist/src/link/file.js +12 -0
  31. package/dist/src/link/redirectTarget.js +1 -1
  32. package/dist/src/nowiki/doubleUnderscore.js +1 -1
  33. package/dist/src/nowiki/index.js +1 -0
  34. package/dist/src/nowiki/listBase.js +1 -1
  35. package/dist/src/table/base.d.ts +5 -0
  36. package/dist/src/table/base.js +3 -10
  37. package/dist/src/table/index.d.ts +2 -2
  38. package/dist/src/table/td.js +8 -5
  39. package/dist/src/tagPair/translate.js +2 -2
  40. package/dist/src/transclude.js +4 -0
  41. package/dist/util/sharable.js +1 -1
  42. package/dist/util/sharable.mjs +2 -2
  43. package/dist/util/string.js +3 -2
  44. package/extensions/dist/base.js +1 -1
  45. package/extensions/dist/lsp.js +3 -2
  46. package/i18n/en.json +1 -0
  47. package/i18n/zh-hans.json +1 -0
  48. package/i18n/zh-hant.json +1 -0
  49. package/package.json +25 -21
package/README.md CHANGED
@@ -15,21 +15,21 @@
15
15
 
16
16
  ## Introduction
17
17
 
18
- WikiParser-Node is an offline [Wikitext](https://www.mediawiki.org/wiki/Wikitext) parser developed by Bhsd for the [Node.js](https://nodejs.org/) environment. It can parse almost all wiki syntax and generate an [Abstract Syntax Tree (AST)](https://en.wikipedia.org/wiki/Abstract_syntax_tree) ([Try it online](https://bhsd-harry.github.io/wikiparser-node/#editor)). It also allows for easy querying and modification of the AST, and returns the modified wikitext.
18
+ WikiParser-Node is an offline [Wikitext](https://www.mediawiki.org/wiki/Wikitext) parser developed by [Bhsd](https://github.com/bhsd-harry) for the [Node.js](https://nodejs.org/) environment. It can parse almost all [wiki syntax](https://www.mediawiki.org/wiki/Help:Advanced_editing) and generate an [Abstract Syntax Tree (AST)](https://en.wikipedia.org/wiki/Abstract_syntax_tree) ([Try it online](https://bhsd-harry.github.io/wikiparser-node/#editor)). It also allows for easy querying and modification of the AST, and returns the modified Wikitext.
19
19
 
20
- Although WikiParser-Node is not originally designed to convert Wikitext to HTML, it provides a limited capability to do so. [Here](https://bhsd-harry.github.io/wikiparser-website/) is a list of example HTML pages rendered using this package.
20
+ Although WikiParser-Node is not originally designed to convert Wikitext to HTML, it provides a limited capability to do so. [Here](https://bhsd-harry.github.io/wikiparser-website/) is a list of example HTML pages from [MediaWiki.org](https://www.mediawiki.org/) rendered using this package.
21
21
 
22
22
  ## Other Versions
23
23
 
24
24
  ### Mini (also known as [WikiLint](https://www.npmjs.com/package/wikilint))
25
25
 
26
- This version provides a [CLI](https://en.wikipedia.org/wiki/Command-line_interface), but only retains the parsing functionality and linting functionality. The parsed AST cannot be modified. It powers the [Wikitext LSP](https://www.npmjs.com/package/wikitext-lsp), which provides multiple language services for editors such as [VS Code](https://marketplace.visualstudio.com/items?itemName=Bhsd.vscode-extension-wikiparser), [Sublime Text](https://lsp.sublimetext.io/language_servers/#mediawiki), and [Helix](https://github.com/helix-editor/helix/wiki/Language-Server-Configurations#wikitext).
26
+ This version provides a [CLI](https://en.wikipedia.org/wiki/Command-line_interface), but only retains the parsing and linting functionality. The parsed AST cannot be modified. It powers the [Wikitext LSP](https://www.npmjs.com/package/wikitext-lsp), which provides multiple language services for editors such as [VS Code](https://marketplace.visualstudio.com/items?itemName=Bhsd.vscode-extension-wikiparser), [Sublime Text](https://lsp.sublimetext.io/language_servers/#mediawiki), and [Helix](https://github.com/helix-editor/helix/wiki/Language-Server-Configurations#wikitext).
27
27
 
28
28
  A list of available linting rules can be found [here](https://github.com/bhsd-harry/wikiparser-node/wiki/Rules).
29
29
 
30
30
  ### Browser-compatible
31
31
 
32
- A browser-compatible version, which can be used for code highlighting or as a linting plugin in conjunction with editors such as [CodeMirror](https://www.npmjs.com/package/@bhsd/codemirror-mediawiki) and [Monaco](https://www.npmjs.com/package/monaco-wiki) ([Usage example](https://bhsd-harry.github.io/wikiparser-node)). It has been integrated into the MediaWiki official [CodeMirror extension](https://www.mediawiki.org/wiki/Extension:CodeMirror) since Release 1.45.
32
+ A browser-compatible version, which can be used for code highlighting or as a [LSP](https://microsoft.github.io/language-server-protocol/) plugin in conjunction with editors such as [CodeMirror](https://www.npmjs.com/package/@bhsd/codemirror-mediawiki) and [Monaco](https://www.npmjs.com/package/monaco-wiki) ([Usage example](https://bhsd-harry.github.io/wikiparser-node)). It has been integrated into the MediaWiki official [CodeMirror extension](https://www.mediawiki.org/wiki/Extension:CodeMirror) since Release 1.45.
33
33
 
34
34
  ## Installation
35
35
 
@@ -72,19 +72,19 @@ For MediaWiki sites with the [CodeMirror extension](https://mediawiki.org/wiki/E
72
72
  ```sh
73
73
  npx getParserConfig <site> <script path> [user] [force]
74
74
  # For example:
75
- npx getParserConfig jawiki https://ja.wikipedia.org/w user@example.net
75
+ npx getParserConfig frwiki https://fr.wikipedia.org/w user@example.net
76
76
  ```
77
77
 
78
- The generated configuration file will be saved in the `config` directory. You can then use the site name for [`Parser.config`](https://github.com/bhsd-harry/wikiparser-node/wiki/Parser-%28EN%29#config).
78
+ The generated configuration file will be saved in the [`config` directory](https://github.com/bhsd-harry/wikiparser-node/tree/main/config/). You can then use the site name for [`Parser.config`](https://github.com/bhsd-harry/wikiparser-node/wiki/Parser-%28EN%29#config).
79
79
 
80
80
  ```javascript
81
81
  // For example:
82
- Parser.config = 'jawiki';
82
+ Parser.config = 'frwiki';
83
83
  ```
84
84
 
85
85
  ### API usage
86
86
 
87
- Please refer to the [Wiki](https://github.com/bhsd-harry/wikiparser-node/wiki/Home-%28EN%29).
87
+ Please refer to the [Wiki](https://github.com/bhsd-harry/wikiparser-node/wiki/Home-%28EN%29). In particular, there are some [usage examples](https://github.com/bhsd-harry/wikiparser-node/wiki/Home-%28EN%29#examples) that demonstrate how to use this package to complete various tasks.
88
88
 
89
89
  ## Performance
90
90