npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mini-dev/markdown-highlight

v0.0.1

Published

Prism 语法高亮支持包 —— fenced code block → 彩色 inline span(微信 rich-text,无组件/无 image)

Readme

@mini-dev/markdown-highlight

@mini-dev/markdown-core 的代码块语法高亮支持包 —— Prism 把 fenced code block token 化成一串带颜色的 inline <span>。

微信 rich-text 原生支持 <span style="color:...">,adapter 对 element IR 透传 props.style,故高亮不产生组件段、不用 image、adapter 零改动。

1. 安装

npm i @mini-dev/markdown-core @mini-dev/markdown-highlight

小程序侧执行「工具 → 构建 npm」(读 "miniprogram": "dist/cjs")。无需注册组件。

2. 用法

const { createMarkdown } = require('@mini-dev/markdown-core');
const { createHighlightPlugin } = require('@mini-dev/markdown-highlight');

const md = createMarkdown();
md.use(createHighlightPlugin());

与 mermaid 共存时,两者都覆盖 code 渲染器;核心把同 type 覆盖折叠成 next 链,后注册者先执行,不命中则交棒。所以 highlight 后注册即可:

md.use(createMermaidPlugin({ resolveSvg }));
md.use(createHighlightPlugin());

3. 选项

createHighlightPlugin({ theme, languages, sealOnlyThreshold })
  • theme —— 覆盖默认色板(GitHub Light,见 DEFAULT_THEME),按 Prism token scope 取色。
  • languages —— 逐项注入/覆盖 grammar。key 必须是归一后的 Prism 名(javascript 而非 js/jsx);写别名不生效并会 console.warn。
  • sealOnlyThreshold —— 流式长代码块 seal-only 阈值(字节,默认 16KB,Infinity 关闭)。流式 trailing code(围栏未闭合,parser 标 meta.open)且 value 超阈值时,跳过每 tick 的 Prism.tokenize、回落纯文本占位,sealed(fence 闭合)/一次性渲染走 final tokenize。根治长代码块 + highlight 的 intra-block O(n²)(50KB 块 push 9.5ms→0.13ms;seal-only 在 16KB 后生效,阈值前仍逐 tick tokenize)。大块越过阈值时 colored→plain 一次过渡是已知 tradeoff。详见 §5.2。

内置语言:js / typescript / python / bash / json / markdown 及其常用别名。未知 lang 交棒给链上下一个渲染器(链尾为内置 code 渲染器,即纯文本代码块)。

4. 文档

5. License

MIT