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

dsh-table-render

v0.1.0

Published

Table render plugin for DeepSeek Harness: render ascii/unicode/markdown tables with CJK-aware column alignment (wide chars count as 2 columns), alignment control, width compression, and display-width measurement. Zero runtime dependencies.

Readme

dsh-table-render

DeepSeek Harness 表格渲染插件:把数据渲染成对齐的 ASCII / Unicode / Markdown 表格,CJK 字符与 emoji 按 2 列宽计算,中文列严格对齐。零运行时依赖。

安装

npm install dsh-table-render

使用说明

render_table —— 表格渲染

用户:把这三个城市的销量做成表格:深圳 100、北京朝阳区 2、A 3

+--------------+------+
| 城市         | 数量 |
+--------------+------+
| 深圳         | 100  |
| 北京朝阳区   | 2    |
| A            | 3    |
+--------------+------+

中文列与英文列混排时每行显示宽度完全一致(不是字节数一致,是终端列宽一致)。

参数

| 参数 | 说明 | |---|---| | data | 数据:JSON 二维数组字符串([["a","1"]])或分隔文本(自动识别 TSV / CSV / 空白分隔) | | headers | 可选表头:"名称,数量" 或 JSON 数组字符串 | | style | ascii(默认)/ unicode(┌─┬┐ 框线)/ markdown(\| a \| b \|) | | align | 默认对齐:left(默认)/ right / center | | column_align | 按列对齐:"left,right,right",未指定的列沿用 align | | max_width | 表格总显示宽度上限,超宽时压缩各列(每列至少 4),超长单元格以 … 截断 |

Markdown 输出示例

| 城市 | 数量 |
| ---- | ---- |
| 深圳 | 100 |

Unicode 输出示例

┌──────┬──────┐
│ 城市 │ 数量 │
├──────┼──────┤
│ 深圳 │ 100  │
└──────┴──────┘

text_width —— 显示宽度测量

排查对齐问题的辅助工具:报告文本的终端显示宽度(CJK/emoji 计 2 列,组合字符与零宽字符计 0 列)与逐行码点数,可选给出按指定宽度截断的结果。

用户:为什么这行中文在终端里没对齐?

总显示宽度:7 列(字符数 5)
逐行:
  1. "中文abc" → 7 列 / 5 码点
按 5 列截断:中文…

统计口径

  • 宽度按终端显示列计算:CJK 汉字/全角标点/emoji 计 2,组合字符(如 e + U+0301)与零宽字符计 0,其余计 1。
  • 遍历按 Unicode 码点,代理对(emoji 等增补平面字符)不会重复计数。
  • 截断时省略号 … 本身占 1 列,截断结果宽度精确等于上限。
  • max_width 含边框开销(3 × 列数 + 1),保证整表宽度不超上限。

版本历史

  • 0.1.0:初始版本——render_table(三种样式、按列对齐、CJK 感知宽度、宽度压缩)、text_width(宽度测量与截断预览)。

FAQ

Q:中文列为什么用空格补而不是制表符? 制表符的对齐依赖终端 tabstop 设置,不可移植。本插件用空格按显示列宽精确补齐,任何等宽终端下都对齐。

Q:emoji 宽度算对了吗? emoji 按 2 列计(主流终端渲染如此)。若你的终端把 emoji 渲染为 1 列,可用 text_width 核对后改用 max_width 规避。

Q:能生成 HTML 表格吗? 不能,本插件专注终端/Markdown 场景的等宽对齐;HTML 交给渲染引擎自动布局即可。

许可证

MIT