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

@zhin.js/html-renderer

v3.0.2

Published

HTML to PNG/SVG for Zhin.js (satori + resvg); optional peer of zhin.js

Readme

@zhin.js/html-renderer

HTML → PNG/SVG,供 Zhin.js 出站富媒体段(segment.html / segment.markdown)与可选 aiTextAsImage 使用。

基于 @zhin.js/satori + @resvg/resvg-js再作为插件加载。

安装

pnpm add @zhin.js/html-renderer

未安装时,Adapter policy 为 html:'image' / markdown:'image' 的出站会自动 降级为 text 并打一次 warning。

配置(zhin.config.yml)

htmlRenderer:
  defaultWidth: 1080
  defaultBackgroundColor: "#ffffff"
  aiTextAsImage: false   # true 时纯文本出站转 PNG(before.sendMessage)

API

import { createHtmlRenderer } from '@zhin.js/html-renderer';

const renderer = createHtmlRenderer({ defaultWidth: 540 });
const png = await renderer.render('<div>Hello</div>', { format: 'png' });

Core 出站链通过动态 import 自动调用,业务代码通常只需 segment.html({ html: '...' })

IM 组件与 Context(安装包后 zhin 启动自动注册)

无需再写 plugins 列表,安装 @zhin.js/html-renderer 后启动时自动:

| 能力 | 说明 | |------|------| | RenderImage 组件 | 模板/命令中 <RenderImage html="..." width="540"/>,异步渲染为 image 段 | | html-renderer Context | useContext('html-renderer', (r) => …)inject('html-renderer') | | Agent 工具 | html_renderhtml_card(需已装 @zhin.js/agent 且 tool 服务可用) |

自定义组件仍用 defineComponent + addComponent;需要转图时在组件内 inject('html-renderer') 或返回 segment.html({ html }) 走出站 policy。