SIGN IN SIGN UP

markdown: Support triple-tilde Mermaid fences (#62257)

# Objective

Zed's Markdown parser accepts tilde-fenced code blocks, but Mermaid
extraction only strips backtick fences. As a result, a block like this
is parsed as Mermaid while the fence itself is still passed to the
renderer:

```markdown
~~~mermaid
graph TD;
~~~
```

## Solution

Teach the Markdown code-block helpers to recognize triple-tilde fences
alongside triple-backtick fences.

The change stays in the existing parsing path, so Mermaid rendering does
not need a separate special case. A regression test covers extraction
from a tilde-fenced Mermaid block.

## Testing

- `cargo fmt --all -- --check`
- `cargo test -p markdown` (138 tests)
- `./script/clippy -p markdown`
- `cargo build -p zed`
- Opened a `~~~mermaid` block in the built Zed Dev app on macOS and
verified that Markdown Preview renders the diagram

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

---

Release Notes:

- Fixed Mermaid diagrams in Markdown previews when they use triple-tilde
fences.

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
K
Kim Seogyu committed
4bd1993783703e92affb781503916d1f152f599f
Parent: d4010e9
Committed by GitHub <noreply@github.com> on 8/10/2026, 1:04:37 PM