Skip to content

feat: Wrap markdown tables in code blocks for better rendering on chat platforms #178

@JARVIS-coding-Agent

Description

@JARVIS-coding-Agent

Problem

LLM 回覆中的 markdown 表格在 Discord 等聊天平台上會被錯誤渲染,導致排版混亂、難以閱讀。

Proposal

導入 pulldown-cmark 作為 markdown parser,建立一個格式化 pipeline:

  • 使用 pulldown-cmark 精準偵測 markdown 表格(而非 regex)
  • 支援三種表格渲染模式,透過 config.toml 設定:
    • code(預設):將表格包在 fenced code block 中
    • bullets:將表格轉為 bullet list
    • off:不處理,原始內容直接送出
  • 設計為通用 pipeline,未來新增其他 channel 時可直接複用,每個 channel 可獨立設定渲染模式

Config Example

[markdown]
tables = "code"

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestgood first issueGood for newcomersp2Medium — planned work

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions