Skip to content

feat(app): add markdown preview with mermaid diagram support - #23688

Closed
Kiruno-lz wants to merge 6 commits into
anomalyco:devfrom
Kiruno-lz:feat/markdown-preview
Closed

Kiruno-lz wants to merge 6 commits into
anomalyco:devfrom
Kiruno-lz:feat/markdown-preview

Conversation

@Kiruno-lz

Copy link
Copy Markdown

Issue for this PR

#13704
#16782
#22079

Closes #14187

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • [] Documentation

What does this PR do?

  • Adds mermaid (v11.4.1) as a dependency
  • When viewing markdown files in preview mode, ```mermaid code blocks are automatically rendered as SVG diagrams
  • Maintains backward compatibility with the existing Preview/Source toggle

How did you verify your code works?

local test

Screenshots / recordings

image image

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Thanks to

@kimi-chen
@southpolesteve
@alankyshum

alankyshum and others added 4 commits April 16, 2026 21:33
Add a Preview/Source toggle for Markdown files in the session file viewer.
Detects .md/.markdown files and defaults to rendered preview mode.
Auto-switches to Source view when navigating to a comment.
Excludes binary files from the toggle.
Includes i18n translations for all 17 supported locales.

Based on work by @kimi-chen in anomalyco#13704.

Co-authored-by: kimi-chen <[email protected]>
Co-Authored-By: Paperclip <[email protected]>
- bg-surface → bg-surface-base (fixes transparent toolbar background)
- bg-surface-active → bg-surface-base-active (fixes toggle button state)
- text-text → text-text-base (fixes button text color)
- border-border → border-border-base (fixes toolbar border)
- Add binary content guard on preview Match condition

Fixes rendering issue reported by KnutZuidema where file contents
showed behind the toolbar due to transparent background.

Refs: BLD-1

Co-authored-by: Copilot <[email protected]>
…nt bleed-through

The toolbar used bg-surface-base which resolves to rgba(0,0,0,0.031) — nearly
transparent. When scrolling, file contents were visible behind the sticky
toolbar. Switch to bg-background-base (#f8f8f8/#101010) which is fully opaque,
matching the pattern used by other sticky headers in the app.
Adds client-side rendering of mermaid diagrams in the markdown file viewer.
When viewing .md/.markdown files in preview mode, mermaid code blocks are
automatically rendered as SVG diagrams.

Closes anomalyco#14187
@Kiruno-lz
Kiruno-lz requested a review from adamdotdevin as a code owner April 21, 2026 12:54
@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

I found a potential duplicate:

Related PR:

Why it might be related:
This PR appears to be addressing the same feature - adding Mermaid diagram visualization in markdown. It could be a previous attempt, an alternative implementation, or a related feature that should be checked for overlap with PR #23688.

I recommend checking if #21497 is already merged, closed, or if it's a duplicate that should be consolidated with the current PR.

@Kiruno-lz Kiruno-lz left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have reviewed all changes
Except for bun.lock, the other codes are solid.
@adamdotdevin

@ochsec

ochsec commented May 6, 2026

Copy link
Copy Markdown
Contributor

Can you please merge this? Big quality of life improvement.

@Kiruno-lz

Copy link
Copy Markdown
Author

Can you please merge this? Big quality of life improvement.

exactly,
and seems this feature even supported at open code-cli. Can't believe it..😢

@Rafik-Belkadi-Reccap

Copy link
Copy Markdown

any update on this? would be really helpful to merge

@thdxr
thdxr requested review from Brendonovich and Hona as code owners June 11, 2026 00:18
@chenjiangui

Copy link
Copy Markdown

急需这个pr

@MYHZ79

MYHZ79 commented Jul 3, 2026

Copy link
Copy Markdown

hi
is there any update for this feature?

@thdxr

thdxr commented Oct 10, 2026

Copy link
Copy Markdown
Member

This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2.

— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

@thdxr thdxr closed this Oct 10, 2026
@Kiruno-lz

Copy link
Copy Markdown
Author

This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2.

— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

I genuinely loved OpenCode, and I'm grateful for how much it helped me back then.

But over the past few months, I've become deeply disappointed with the direction OpenCode has taken.

Just look at Codex and Maka.

To be frank, V2 didn't feel like much of a meaningful improvement to me. Even after V2 was released, I continued using V1 extensively simply because I found it better to use.

This PR was about a meaningful improvement to the user experience.

It's completely fair to reject a PR if you don't think the implementation is good enough. It's also fair to suggest improvements and help contributors understand what needs to change.

But coming back six months later with nothing more than "Sorry, we've moved to V2" feels incredibly dismissive.

I understand that maintaining a project of this scale and managing contributions must be overwhelming. But that doesn't make the experience any less discouraging for those of us who genuinely cared about the project and wanted to make it better.

Anyway, I've moved on to Codex.

我非常喜欢opencode,也很感谢opencode对我那段时间的帮助
但是这几个月下来我对opencode非常失望
你看看codex,maka
说实话V2的更新是无关痛痒的,更新了V2之后我还在大量使用V1,因为我觉得V1更好用
这是个重要的使用体验功能更新,
你可以觉得大家做得不够好而拒绝合并
你可以给出建议告诉大家怎么做的更好
而不是过了6个月之后冰冷地来一句抱歉我们更新到V2了
我理解你们合并分支的压力非常大,但仍然让我们觉得心寒
无所谓,我已经转向使用codex

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Add markdown preview toggle in file viewer sidebar

7 participants