# markdown: Support triple-tilde Mermaid fences \(\#62257\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/4bd1993783703e92affb781503916d1f152f599f)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 4bd1993783703e92affb781503916d1f152f599f

Requested commit: 4bd1993783703e92affb781503916d1f152f599f

Commit: 4bd1993783703e92affb781503916d1f152f599f

Tree: e0e36eac0f5a901176c301726f402dac6bfe09a0

Author: Kim Seogyu

Committer: GitHub

## Message

````
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>
````

## Parents

- [d4010e91ccc9635853698af160f15bb479a484d0](https://git.cafe/gitcafe/zed/commit/d4010e91ccc9635853698af160f15bb479a484d0?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/4bd1993783703e92affb781503916d1f152f599f?format=markdown)
