Skip to content

[Copilot UI] Harden incremental Markdown rendering for streamed answers #28

Open

Description

@helsome

Background

README 已有 Markdown / streaming 基础能力,但“最终字符串能渲染 Markdown”不等于“流式生成过程中 Markdown 始终可用”。

真实 Copilot 会不断追加不完整的 Markdown:半个表格、未闭合 code fence、列表、引用、链接、公式或 citation marker。简单地每个 token 全量重新 parse/render,容易产生闪烁、布局跳动、表格损坏、滚动位置抖动以及长回答性能退化。

需要把 Markdown renderer 做成可验证的 production streaming surface。

Requirements

Rendering

至少稳定支持:

  • headings / paragraphs;
  • ordered/unordered lists;
  • blockquotes;
  • emphasis;
  • fenced code blocks;
  • Markdown tables / GFM table;
  • links;
  • inline citation/evidence markers;
  • long financial reports containing many sections/tables。

Incremental behavior

  • 不完整 block 在 stream 中不能导致整个消息树崩溃;
  • 新 delta 到达后只进行必要更新,避免每 token 全页重建造成明显 flicker;
  • stream 完成后的最终 DOM/内容与一次性静态渲染语义一致;
  • 用户主动滚动离开底部后,stream 不应持续抢回 scroll position;
  • code/table 等复杂块完成时允许平滑升级,不丢失前文。

Security

Performance

建立至少一个长回答 benchmark/fixture,避免 O(n²) 式随着 token 增长越来越卡。

Related: #27 #13

Acceptance Criteria

  • streaming 中未闭合 table/code/list 等不会导致渲染崩溃或前文消失。
  • 最终 streamed render 与相同完整 Markdown 的 static render 语义一致。
  • table/code/link/citation 可与真实 Copilot stream 一起工作。
  • 外部链接有安全打开策略,恶意 Markdown/HTML 有 XSS regression tests。
  • 用户离开底部时不会被强制 auto-scroll 拉回。
  • 长回答持续 streaming 时无明显逐 token 全页面重建问题,并有可重复性能测试。
  • PR 附一次真实模型生成的长 Markdown 回答录屏/截图,至少包含表格、列表、代码/引用之一和 evidence links,并给出恶意 Markdown 安全测试结果。

Non-goals

  • 不是重新做一套富文本编辑器。
  • 不要求支持任意 HTML;优先保证安全、稳定的 Markdown/GFM 阅读体验。

Activity

  1. wcy12378 commented on Sep 11, 2026

    @wcy12378
    Contributor

    我来也

  2. added
    claimed
    on Sep 11, 2026
  3. github-actions commented on Sep 11, 2026

    @github-actions

    @lengmaooo 这个 Issue 已经由 @wcy12378 认领。

  4. github-actions commented on Sep 21, 2026

    @github-actions

    @wcy12378 这个 Issue 已认领超过 7 天,目前没有发现关联的 open PR,也没有看到最近 7 天的进度更新。

    如果仍在推进,请在 3 天内 留一条简短进度说明(包括正在等待的前置依赖也可以);如果已经有 PR,请贴出链接。若 3 天内没有回应,认领会自动释放,方便其他贡献者接手。

  5. removed
    claimed
    on Sep 25, 2026
  6. github-actions commented on Sep 25, 2026

    @github-actions

    @wcy12378 在提醒后 3 天内没有进度回应,且仍未发现关联的 open PR;本次认领已自动释放。Issue 保持开放,可以重新认领。

  7. Guo-Yixin commented on Sep 26, 2026

    @Guo-Yixin
    Contributor

    /claim

    我来处理 #28 的一个独立子范围:规范化 streamed Markdown parser 的 CRLF 行尾。

    当前 parseAnswerSegments 直接按 \n 切分,Windows CRLF 会把 \r 残留到 text / typed block body,导致流式片段与静态 Markdown 的输入不一致。本 PR 只修改行尾归一化和对应回归测试,不改 Markdown renderer、滚动策略或安全策略。

  8. added
    claimed
    on Sep 26, 2026
  9. github-actions commented on Sep 26, 2026

    @github-actions

    @Guo-Yixin 已认领该 Issue,并已自动设为 Assignee。提交 PR 时请在描述中写 Closes #28。

  10. Guo-Yixin commented on Sep 26, 2026

    @Guo-Yixin
    Contributor

    经进一步复现和代码审查,CRLF 残留是当前 parser 为保留原始 Markdown / typed block 输入而有意保留的行为,现有 renderer 不会产生可证明的用户可见错误。为避免提交低信号改动,我暂不继续这个子范围,并释放本次认领,后续有更明确的 streaming 回归再处理。

  11. Guo-Yixin commented on Sep 26, 2026

    @Guo-Yixin
    Contributor

    /release

  12. 3 remaining items

  13. yu1128-L commented on Oct 3, 2026

    @yu1128-L
    Contributor

    /claim

  14. added
    claimed
    on Oct 3, 2026
  15. github-actions commented on Oct 3, 2026

    @github-actions

    @yu1128-L 已认领该 Issue,并已自动设为 Assignee。提交 PR 时请在描述中写 Closes #28。

  16. github-actions commented on Oct 11, 2026

    @github-actions

    @yu1128-L 这个 Issue 已认领超过 7 天,目前没有发现关联的 open PR,也没有看到最近 7 天的进度更新。

    如果仍在推进,请在 3 天内 留一条简短进度说明(包括正在等待的前置依赖也可以);如果已经有 PR,请贴出链接。若 3 天内没有回应,认领会自动释放,方便其他贡献者接手。

  17. removed
    claimed
    on Oct 15, 2026
  18. github-actions commented on Oct 15, 2026

    @github-actions

    @yu1128-L 在提醒后 3 天内没有进度回应,且仍未发现关联的 open PR;本次认领已自动释放。Issue 保持开放,可以重新认领。

  19. Lym308758 commented on Oct 16, 2026

    @Lym308758
    Contributor

    /claim

  20. added
    claimed
    on Oct 16, 2026
  21. github-actions commented on Oct 16, 2026

    @github-actions

    @Lym308758 已认领该 Issue,并已自动设为 Assignee。提交 PR 时请在描述中写 Closes #28。

  22. Lym308758 commented on Oct 16, 2026

    @Lym308758
    Contributor

    提交了一个针对 #28 的独立子范围 PR:#324

    覆盖验收标准 5(离开底部不被拉回,补回归)与标准 6(长回答流式不逐 token 全页重建 + 可重复性能测试)。两个 commit 分别做“流式块级增量渲染”与“抽取 auto-scroll 跟随策略”。流结束后仍走整文渲染,保证最终 DOM 与此前一致。

    详细改动/设计取舍/验证报告见 PR 描述。验收标准 7(真实模型录屏 + 安全测试)建议合入后补。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

claimed

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions