{"id":15001822,"url":"https://github.com/bhsd-harry/wikiparser-node","last_synced_at":"2026-04-02T13:56:40.926Z","repository":{"id":41479078,"uuid":"485101697","full_name":"bhsd-harry/wikiparser-node","owner":"bhsd-harry","description":"A Node.js/browser parser for MediaWiki markup with AST","archived":false,"fork":false,"pushed_at":"2026-01-22T10:24:53.000Z","size":24476,"stargazers_count":41,"open_issues_count":3,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2026-01-23T01:34:05.265Z","etag":null,"topics":["browser","linter","lsp-server","mediawiki","nodejs","parser","wikitext"],"latest_commit_sha":null,"homepage":"https://bhsd-harry.github.io/wikiparser-node/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bhsd-harry.png","metadata":{"files":{"readme":"README-(ZH).md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-04-24T18:02:03.000Z","updated_at":"2026-01-22T10:20:21.000Z","dependencies_parsed_at":"2025-12-05T13:03:33.677Z","dependency_job_id":null,"html_url":"https://github.com/bhsd-harry/wikiparser-node","commit_stats":{"total_commits":635,"total_committers":2,"mean_commits":317.5,"dds":0.04251968503937009,"last_synced_commit":"8a76ca49fc4cedb56fbaadfb437c3a7c98e3b790"},"previous_names":[],"tags_count":431,"template":false,"template_full_name":null,"purl":"pkg:github/bhsd-harry/wikiparser-node","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bhsd-harry%2Fwikiparser-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bhsd-harry%2Fwikiparser-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bhsd-harry%2Fwikiparser-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bhsd-harry%2Fwikiparser-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bhsd-harry","download_url":"https://codeload.github.com/bhsd-harry/wikiparser-node/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bhsd-harry%2Fwikiparser-node/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29227379,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-08T09:43:19.170Z","status":"ssl_error","status_checked_at":"2026-02-08T09:42:55.556Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["browser","linter","lsp-server","mediawiki","nodejs","parser","wikitext"],"created_at":"2024-09-24T18:30:59.250Z","updated_at":"2026-02-08T10:01:53.676Z","avatar_url":"https://github.com/bhsd-harry.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\u003cimg src=\"https://github.com/bhsd-harry/wikiparser-node/raw/main/logo.png\" width=\"200\" alt=\"WikiParser-Node logo\"\u003e\u003c/div\u003e\n\n# WikiParser-Node\n\n[![npm version](https://badge.fury.io/js/wikiparser-node.svg)](https://www.npmjs.com/package/wikiparser-node)\n[![CodeQL](https://github.com/bhsd-harry/wikiparser-node/actions/workflows/codeql.yml/badge.svg)](https://github.com/bhsd-harry/wikiparser-node/actions/workflows/codeql.yml)\n[![CI](https://github.com/bhsd-harry/wikiparser-node/actions/workflows/node.js.yml/badge.svg)](https://github.com/bhsd-harry/wikiparser-node/actions/workflows/node.js.yml)\n[![jsDelivr hits (npm)](https://img.shields.io/jsdelivr/npm/hm/wikiparser-node)](https://www.npmjs.com/package/wikiparser-node)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/a2fbe7641031451baca2947ae6d7891f)](https://app.codacy.com/gh/bhsd-harry/wikiparser-node/dashboard)\n![Istanbul coverage](./coverage/badge.svg)\n\n## Other Languages\n\n- [English](./README.md)\n\n## 简介\n\nWikiParser-Node 是一款由 Bhsd 开发的基于 [Node.js](https://nodejs.org/) 环境的离线[维基文本](https://www.mediawiki.org/wiki/Wikitext)语法解析器，可以解析几乎全部的维基语法并生成[语法树](https://en.wikipedia.org/wiki/Abstract_syntax_tree)（[在线解析](https://bhsd-harry.github.io/wikiparser-node/#editor)），还可以很方便地对语法树进行查询和修改，最后返回修改后的维基文本。\n\n尽管 WikiParser-Node 并非专门用于将维基文本转换为 HTML，但它提供了有限的转换能力。[这里](https://bhsd-harry.github.io/wikiparser-website/)是一个使用这个库渲染的 HTML 示例页面列表。\n\n## 其他版本\n\n### Mini (又名 [WikiLint](https://www.npmjs.com/package/wikilint))\n\n提供了 [CLI](https://en.wikipedia.org/wiki/Command-line_interface)，但仅保留了解析功能和语法错误分析功能，解析生成的语法树不能修改。这个版本为 [Wikitext 语言服务器协议](https://www.npmjs.com/package/wikitext-lsp)提供支持，可为 [VS Code](https://marketplace.visualstudio.com/items?itemName=Bhsd.vscode-extension-wikiparser)、[Sublime Text](https://lsp.sublimetext.io/language_servers/#mediawiki) 和 [Helix](https://github.com/helix-editor/helix/wiki/Language-Server-Configurations#wikitext) 等编辑器提供多种语言服务。\n\n可用的语法检查规则列表请见[这里](https://github.com/bhsd-harry/wikiparser-node/wiki/Rules)。\n\n### Browser-compatible\n\n兼容浏览器的版本，可用于代码高亮或是搭配 [CodeMirror](https://www.npmjs.com/package/@bhsd/codemirror-mediawiki) 和 [Monaco](https://www.npmjs.com/package/monaco-wiki) 等编辑器作为语法分析插件（[使用实例展示](https://bhsd-harry.github.io/wikiparser-node)）。自 1.45 版本起已集成到 MediaWiki 官方 [CodeMirror 扩展](https://www.mediawiki.org/wiki/Extension:CodeMirror)中。\n\n## 安装方法\n\n### Node.js\n\n请根据需要需要安装对应的版本（`WikiParser-Node` 或 `WikiLint`），如：\n\n```sh\nnpm i wikiparser-node\n```\n\n或\n\n```sh\nnpm i wikilint\n```\n\n### 浏览器\n\n可以通过 CDN 下载代码，如：\n\n```html\n\u003cscript src=\"//cdn.jsdelivr.net/npm/wikiparser-node\"\u003e\u003c/script\u003e\n```\n\n或\n\n```html\n\u003cscript src=\"//unpkg.com/wikiparser-node/bundle/bundle-lsp.min.js\"\u003e\u003c/script\u003e\n```\n\n更多浏览器端可用的插件请查阅对应[文档](https://github.com/bhsd-harry/wikiparser-node/wiki/Browser)。\n\n## 使用方法\n\n### CLI 使用方法\n\n对于安装了 [CodeMirror 扩展](https://mediawiki.org/wiki/Extension:CodeMirror)的 MediaWiki 站点，如不同语言版本的维基百科和其他[由维基媒体基金会托管的站点](https://meta.wikimedia.org/wiki/Special:SiteMatrix)，可以使用以下命令获取解析器配置：\n\n```sh\nnpx getParserConfig \u003csite\u003e \u003cscript path\u003e [user] [force]\n# 例如：\nnpx getParserConfig jawiki https://ja.wikipedia.org/w user@example.net\n```\n\n生成的配置文件将保存在 `config` 目录下，然后就可以使用站点名称设置 [`Parser.config`](https://github.com/bhsd-harry/wikiparser-node/wiki/Parser#config)。\n\n```javascript\n// 例如：\nParser.config = 'jawiki';\n```\n\n### API 使用方法\n\n请查阅 [Wiki](https://github.com/bhsd-harry/wikiparser-node/wiki)。\n\n## 性能\n\n在一台个人的 MacBook Air 上对英文维基百科约 1900 万篇条目的数据库转储文件（`*.xml.bz2`）的一次完整[扫描](https://www.npmjs.com/package/lint-wiki-dumps)（解析和语法错误分析）需要约 5 小时。\n\n## 已知问题\n\n请参阅[英语版本](./README.md#known-issues)。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbhsd-harry%2Fwikiparser-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbhsd-harry%2Fwikiparser-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbhsd-harry%2Fwikiparser-node/lists"}