{"id":15960709,"url":"https://github.com/bhsd-harry/prism-wiki","last_synced_at":"2026-02-05T08:09:21.988Z","repository":{"id":229010557,"uuid":"775527646","full_name":"bhsd-harry/prism-wiki","owner":"bhsd-harry","description":"A Prism gadget for MediaWiki sites","archived":false,"fork":false,"pushed_at":"2026-01-28T06:38:17.000Z","size":859,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-28T23:10:31.213Z","etag":null,"topics":["highlight","mediawiki","mediawiki-gadget","prismjs","wikitext"],"latest_commit_sha":null,"homepage":"https://bhsd-harry.github.io/prism-wiki/","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.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":"2024-03-21T14:58:41.000Z","updated_at":"2026-01-28T06:38:17.000Z","dependencies_parsed_at":"2024-03-23T17:22:23.546Z","dependency_job_id":"e0f6c1a7-8586-4240-9156-c5a4e109d160","html_url":"https://github.com/bhsd-harry/prism-wiki","commit_stats":{"total_commits":41,"total_committers":2,"mean_commits":20.5,"dds":0.07317073170731703,"last_synced_commit":"6e64111fb26383a2982a65a941e6a7a3a8ccc745"},"previous_names":["bhsd-harry/prism-wiki"],"tags_count":30,"template":false,"template_full_name":null,"purl":"pkg:github/bhsd-harry/prism-wiki","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bhsd-harry%2Fprism-wiki","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bhsd-harry%2Fprism-wiki/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bhsd-harry%2Fprism-wiki/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bhsd-harry%2Fprism-wiki/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bhsd-harry","download_url":"https://codeload.github.com/bhsd-harry/prism-wiki/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bhsd-harry%2Fprism-wiki/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29116452,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T05:31:32.482Z","status":"ssl_error","status_checked_at":"2026-02-05T05:31:29.075Z","response_time":65,"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":["highlight","mediawiki","mediawiki-gadget","prismjs","wikitext"],"created_at":"2024-10-07T15:21:25.032Z","updated_at":"2026-02-05T08:09:21.981Z","avatar_url":"https://github.com/bhsd-harry.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Prism-Wiki\n\n[![npm version](https://badge.fury.io/js/prism-wiki.svg)](https://www.npmjs.com/package/prism-wiki)\n[![CodeQL](https://github.com/bhsd-harry/prism-wiki/actions/workflows/codeql.yml/badge.svg)](https://github.com/bhsd-harry/prism-wiki/actions/workflows/github-code-scanning/codeql)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/6e3f4c7dd6a94c1cb384aa929b899f5c)](https://app.codacy.com/gh/bhsd-harry/prism-wiki/dashboard)\n\n**Prism-Wiki** 是由 Bhsd 编写的一款用于 MediaWiki 站点的代码块高亮小工具，主要基于 [Prism](https://prismjs.com/)，并使用 [WikiParser-Node](https://www.npmjs.com/package/wikiparser-node) 改进对[维基文本](https://www.mediawiki.org/wiki/Wikitext)的高亮模式。\n\n**Prism-Wiki** 也能用于在非 MediaWiki 的浏览器或 [Node.js](https://nodejs.org/) 环境下改进 [Prism](https://prismjs.com/) 对[维基文本](https://www.mediawiki.org/wiki/Wikitext)的高亮支持，详见 [Node.js 用法](#nodejs-用法)。使用案例可以参考 [WikiParser-Node](https://www.npmjs.com/package/wikiparser-node) 渲染的 [`\u003csyntaxhighlight\u003e` 标签](https://bhsd-harry.github.io/wikiparser-website/Help%3ARecent_changes#L-1)。\n\n## MediaWiki 站点小工具\n\n### 使用方法\n\n在*个人 JS 页*添加以下代码：\n\n```js\nmw.loader.load('//cdn.jsdelivr.net/npm/prism-wiki');\n```\n\n或\n\n```js\nmw.loader.load('//unpkg.com/prism-wiki/dist/main.min.js');\n```\n\n所有指定了语言的代码块都会被自动高亮，未指定语言的代码块可以双击后手动输入语言并高亮。\n\n### 设置\n\n根据需要在加载小工具之前添加以下代码：\n\n```js\nwindow.Prism = window.Prism || {};\nPrism.theme = ''; // 主题，可省略\nPrism.pluginPaths = []; // 插件相对路径，可省略\nPrism.CDN = 'https://cdn.jsdelivr.net'; // jsDelivr 端点，可省略\n```\n\n#### 主题\n\n所有可用的 Prism 主题都可以在[这里](https://prismjs.com/examples)找到。\n\n#### 插件相对路径\n\n所有可用的 Prism 插件都可以在[这里](https://github.com/PrismJS/prism/tree/master/plugins)找到。插件路径需相对于 `plugins/` 填写，注意有些插件同时包含了 JavaScript 和 CSS 文件，例如加载 `autolinker` 插件：\n\n```js\nPrism.pluginPaths = [\n\t'autolinker/prism-autolinker.min.js',\n\t'autolinker/prism-autolinker.min.css',\n];\n```\n\n小工具总是加载 `line-numbers`、`show-language`、`copy-to-clipboard` 和 `inline-color` 插件，不需要手动添加。\n\n#### CDN\n\n小工具默认从 `fastly.jsdelivr.net` 加载 Prism 库，但也可指定其他 [jsDelivr CDN](https://www.jsdelivr.com/network)，例如 `cdn.jsdelivr.net` 或 `fastly.jsdelivr.net`。\n\n## Node.js 用法\n\n### 安装\n\n```bash\nnpm install prismjs wikilint # peer dependencies\nnpm install prism-wiki\n```\n\n### 示例\n\n```js\nconst Prism = require('prismjs'),\n\tParser = require('wikilint'),\n\tregisterWiki = require('prism-wiki').default;\n\nregisterWiki(Prism, Parser);\nPrism.highlight('[[Foo]]', Prism.languages.wiki, 'wiki');\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbhsd-harry%2Fprism-wiki","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbhsd-harry%2Fprism-wiki","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbhsd-harry%2Fprism-wiki/lists"}