Home (EN) - bhsd-harry/wikiparser-node GitHub Wiki
WikiParser-Node is an offline Wikitext parser developed by Bhsd for the Node.js environment. It can parse almost all wiki syntax and generate an Abstract Syntax Tree (AST). It also allows for easy querying and modification of the AST, and returns the modified Wikitext.
Each node of the AST corresponds to a class Token modeled after the HTMLElement class. This Wiki will introduce the properties and methods available for each type of Token corresponding to different wiki syntax.
See WikiLint. This version provides a CLI, but only retains the parsing functionality and linting functionality. The parsed AST cannot be modified. It powers the Wikitext LSP, which provides multiple language services for editors such as VS Code, Sublime Text, and Helix.
A list of available linting rules can be found here.
A browser-compatible version, which can be used for code highlighting or as a linting plugin in conjunction with editors such as CodeMirror and Monaco (Usage example). It has been integrated into the MediaWiki official CodeMirror extension since Release 1.45.
Please install the corresponding version as needed (WikiParser-Node or WikiLint), for example:
npm i wikiparser-nodeor
npm i wikilintYou can download the code via CDN, for example:
<script src="//cdn.jsdelivr.net/npm/wikiparser-node@browser/bundle/bundle-lsp.min.js"></script>or
<script src="//unpkg.com/wikiparser-node@browser/bundle/bundle-lsp.min.js"></script>For more browser extensions, please refer to the corresponding documentation.
Please refer to the document of the main entry and the corresponding documents of each type of Token.
A full list of linting rules can be found here.
A complete test list based on the MediaWiki PHP parser is available here.