ascii-table-renderer

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

When to use this skill

何时使用此Skill

CRITICAL TRIGGER RULE
  • Use this skill ONLY when the user explicitly mentions the exact skill name:
    ascii-table-renderer
    .
Trigger phrases include:
  • "ascii-table-renderer"
  • "use ascii-table-renderer"
  • "用 ascii-table-renderer 把列表打印成表格"
  • "使用 ascii-table-renderer 生成 ASCII 表格(对齐/列宽)"
核心触发规则
  • 仅当用户明确提及确切的Skill名称:
    ascii-table-renderer
    时,才可使用此Skill。
触发短语包括:
  • "ascii-table-renderer"
  • "使用ascii-table-renderer"
  • "用 ascii-table-renderer 把列表打印成表格"
  • "使用 ascii-table-renderer 生成 ASCII 表格(对齐/列宽)"

Boundary

边界限制

  • Do not fetch data (DB/API). Only render and format output.
  • Default borders are ASCII-only:
    + - |
    .
  • Out of scope: merged cells, multi-row headers, complex spanning layouts.
  • 不获取数据(数据库/API)。仅负责渲染和格式化输出。
  • 默认边框仅使用ASCII字符:
    + - |
  • 超出范围:合并单元格、多行表头、复杂跨列布局。

How to use this skill

如何使用此Skill

Inputs

输入参数

  • headers (required)
  • rows (required)
  • maxWidth (default 80)
  • maxColWidth (default 20)
  • borderStyle (light | minimal, default light)
  • overflow (ellipsis | wrap, default ellipsis)
  • align (left | right | center, default left)
  • headers(必填)
  • rows(必填)
  • maxWidth(默认值80)
  • maxColWidth(默认值20)
  • borderStyle(light | minimal,默认light)
  • overflow(ellipsis | wrap,默认ellipsis)
  • align(left | right | center,默认left)

Outputs (required)

输出结果(必填)

  • tableCompact (log-friendly)
  • tableReadable (interactive-friendly)
  • rules (width/truncation/null/alignment rules)
  • tableCompact(适合日志场景)
  • tableReadable(适合交互场景)
  • rules(宽度/截断/空值/对齐规则)

Steps

操作步骤

  1. Compute per-column widths:
    min(maxColWidth, max(contentWidth))
  2. Handle overflow:
    • ellipsis: use
      ...
      consistently
    • wrap: wrap within column width while keeping row alignment
  3. Output two variants:
    • compact: minimal or fewer separators
    • readable: clearer borders
  1. 计算每列宽度:
    min(maxColWidth, max(contentWidth))
  2. 处理溢出:
    • ellipsis:统一使用
      ...
    • wrap:在列宽范围内换行,同时保持行对齐
  3. 输出两种变体:
    • compact:极简样式或更少分隔符
    • readable:更清晰的边框

Script

脚本

  • scripts/render_table.py
    : render tables from JSON stdin (compact/readable)
  • scripts/render_table.py
    :从JSON标准输入渲染表格(紧凑/易读两种样式)

Examples

示例

  • examples/basic.md
  • examples/basic.md

Quality checklist

质量检查清单

  1. Columns align consistently; each line does not exceed maxWidth
  2. Null values are rendered as
    -
  3. Copy/paste safe (no trailing spaces)
  1. 列对齐一致;每行长度不超过maxWidth
  2. 空值渲染为
    -
  3. 支持复制粘贴(无尾随空格)

Keywords

关键词

English: ascii-table-renderer, ascii table, align, columns, rows, truncate, wrap, terminal, log 中文: ascii-table-renderer, ASCII 表格, 对齐, 列宽, 截断, 换行, 终端, 日志, 工单
英文: ascii-table-renderer, ascii table, align, columns, rows, truncate, wrap, terminal, log 中文: ascii-table-renderer, ASCII 表格, 对齐, 列宽, 截断, 换行, 终端, 日志, 工单