@franlol/opencode-md-table-formatter

中文文档
0.0.6发布于 2026/02/21MITES Module零依赖近 30 天下载 6823

Markdown table formatter plugin for OpenCode with concealment mode support

原始使用文档
文档目录8 节
  1. Usage
  2. Example
  3. Features
  4. How It Works
  5. Troubleshooting
  6. Requirements
  7. License
  8. Links

@franlol/opencode-md-table-formatter

Markdown table formatter plugin for Opencode with concealment mode support.

Usage

Add the plugin to your .opencode/opencode.jsonc:

{
  "plugin": ["@franlol/opencode-md-table-formatter@latest"],
}

Example

Original Formatted
Screenshot 1 Screenshot 2

Features

  • Automatic table formatting - Formats markdown tables after AI text completion
  • Concealment mode compatible - Correctly calculates column widths when markdown symbols are hidden
  • Alignment support - Left (:---), center (:---:), and right (---:) text alignment
  • Nested markdown handling - Strips bold, italic, strikethrough with multi-pass algorithm
  • Code block preservation - Preserves markdown symbols inside inline code (`**bold**`)
  • Edge case handling - Emojis, unicode characters, empty cells, long content
  • Silent operation - No console logs, errors don't interrupt workflow
  • Validation feedback - Invalid tables get helpful error comments

Key behaviors:

  • Bold/italic symbols outside code are hidden by concealment but width calculated correctly
  • **bold** inside backticks shows as literal text with proper spacing
  • Emojis and unicode characters align properly
  • Columns have consistent spacing

How It Works

This plugin uses Opencode's experimental.text.complete hook to format markdown tables after the AI finishes generating text. It intelligently strips markdown symbols (for width calculation) while preserving symbols inside inline code blocks, ensuring tables align correctly ONLY with Opencode's concealment mode enabled (the default setting).

The plugin uses a multi-pass regex algorithm to handle nested markdown (like **bold with code inside**) and caches width calculations for performance.

Troubleshooting

Tables not formatting?

  • Ensure the plugin is listed in your .opencode/opencode.jsonc config
  • Restart Opencode after adding the plugin
  • Check that tables have a separator row (|---|---|)

Invalid table structure comment?

  • The plugin validates tables before formatting
  • All rows must have the same number of columns
  • Tables must have at least 2 rows including the separator

Requirements

  • Opencode >= 1.0.137

License

MIT © franlol

版本与发布记录

@franlol/opencode-md-table-formatter 共发布 5 个版本,首次发布于 2025/12/08;过去 12 个月发布了 5 个版本。

版本发布日期距今
0.0.6latest2026/02/218 个月前
0.0.52026/02/218 个月前
0.0.42026/02/218 个月前
0.0.32025/12/0911 个月前
0.0.22025/12/0811 个月前

关于 @franlol/opencode-md-table-formatter 的常见问题

@franlol/opencode-md-table-formatter 是什么?

Markdown table formatter plugin for OpenCode with concealment mode support

如何安装 @franlol/opencode-md-table-formatter?

在项目目录运行 npm install @franlol/opencode-md-table-formatter,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@opencode-ai/plugin(>=0.13.7)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@franlol/opencode-md-table-formatter 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/franlol__opencode-md-table-formatter 是否存在。

@franlol/opencode-md-table-formatter 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@franlol/opencode-md-table-formatter 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@franlol/opencode-md-table-formatter 可以商用吗?

@franlol/opencode-md-table-formatter 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@franlol/opencode-md-table-formatter 的下载量有多少?

根据 npm 官方下载统计,@franlol/opencode-md-table-formatter 在 2026/10/16 – 2026/11/14 这 30 天内被下载 6,823 次,日均约 227 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@franlol/opencode-md-table-formatter 还在维护吗?

最新版本 0.0.6 发布于 2026/02/21(8 个月前);至今共发布 5 个版本,其中过去 12 个月发布了 5 个;首次发布于 2025/12/08。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。