---
title: "Mermaid in Markdown: GitHub, GitLab, Obsidian and VS Code"
description: "In Markdown, a Mermaid diagram is a fenced code block with the language set to mermaid. GitHub, GitLab, Obsidian and the VS Code preview draw it without a plugin. What changes from one to the next is the Mermaid version, and a few extras each of them adds."
date: 2026-11-29
lang: en
canonical: https://goingstellar.ro/methods/mermaid-in-markdown-github-gitlab-obsidian-vscode/
author: Going Stellar
publisher: GOING STELLAR S.R.L.
topic: Mermaid / Markdown
license: CC BY 4.0
alternate_ro: https://goingstellar.ro/ro/metode/diagrame-mermaid-in-markdown-github-gitlab-obsidian/
---

# Mermaid in Markdown: GitHub, GitLab, Obsidian and VS Code

*In Markdown, a Mermaid diagram is a fenced code block with the language set to mermaid. GitHub, GitLab, Obsidian and the VS Code preview draw it without a plugin. What changes from one to the next is the Mermaid version, and a few extras each of them adds.*

> Mermaid · Markdown · 2026-11-29 · https://goingstellar.ro/methods/mermaid-in-markdown-github-gitlab-obsidian-vscode/

## Key points

- A Mermaid diagram in Markdown is a code block that opens with ````mermaid`.
- GitHub, GitLab, Obsidian and the VS Code preview render it with no plugin.
- Each tool has its own Mermaid version; a block with only `info` shows which.
- `accTitle` and `accDescr` make the diagram readable by screen readers.

## The code block

Open a fenced code block with three backticks and the word `mermaid`, write the diagram, and close the block. Nothing else is needed:

```markdown
```mermaid
flowchart TD
    A[Write Markdown] --> B[Add a mermaid code block]
```
```

Where Markdown supports Mermaid, the block shows as a diagram; where it does not, it shows as code, so the text is never lost. The whole diagram inside the block:

```mermaid
flowchart TD
    A[Write Markdown] --> B[Add a mermaid code block]
    B --> C[Preview or push]
    C --> D[The diagram renders]
```

Open this example in the editor (Markdown: a diagram in a mermaid code block).

## Which tools draw it

| Where | What it renders | Note |
|---|---|---|
| GitHub | Issues, discussions, pull requests, wikis and Markdown files | third-party Mermaid plugins can cause errors |
| GitLab | Markdown in issues, merge requests, wikis and files | Mermaid 12 |
| Obsidian | `mermaid` code blocks in notes | internal links via a class |
| VS Code | the built-in Markdown preview | pan, zoom, copy source |

## Which Mermaid version?

Each tool ships its own copy of Mermaid, so a diagram type or option added recently may work in one and not in another. GitHub's documentation suggests a block containing only `info`: it renders the version in use.

```markdown
```mermaid
info
```
```

In our editor it shows v12.3.0; GitLab's documentation says it supports Mermaid 12. If a diagram works in an editor but not on your site, compare the versions first.

## GitHub

Diagrams render in issues, discussions, pull requests, wikis and Markdown files. GitHub also renders `geojson`, `topojson` and `stl` blocks, but not PlantUML. Its documentation warns that running a third-party Mermaid plugin on GitHub can cause errors.

## GitLab

GitLab renders the `mermaid` block in its Markdown and documents Mermaid 12. Its own examples start each diagram with `accTitle` and `accDescr`, which give the drawing a title and a description for screen readers:

```mermaid
flowchart LR
    accTitle: Release flow
    accDescr: A pull request is reviewed, merged into main and deployed.
    PR[Pull request] --> R{Review}
    R -- approved --> M[Merge to main]
    M --> D[Deploy]
```

Open this example in the editor (Markdown: accessible title and description).

On GitLab Self-Managed, a `Cross-Origin-Resource-Policy` header set to `same-site` or `same-origin` makes diagrams fail without an error; GitLab's fix is `cross-origin`.

## Obsidian

Obsidian draws `mermaid` code blocks in notes. Its extra: give nodes the `internal-link` class and they link to the notes with those names.

```mermaid
graph TD
    Biology --> Chemistry
    class Biology,Chemistry internal-link;
```

Open this example in the editor (Markdown: Obsidian internal links).

Outside Obsidian the class does nothing, so the same note still renders on GitHub, without the links. Obsidian notes that links from diagrams do not show in its graph view.

## VS Code

The built-in Markdown preview (Ctrl/⌘ + Shift + V) renders Mermaid code blocks without an extension. Hover the diagram for pan and zoom controls; the context menu has **Copy Diagram Source**.

## Confluence

Confluence Cloud does not render Mermaid on its own. Mermaid Studio for Confluence, our app, does: type `/Mermaid` on a page, write or paste the code with a live preview, or start from one of eight templates (flowchart, sequence, Gantt, class, ER, state, pie, mind map). The diagram follows Confluence's light or dark mode, or keeps one of five themes. Copying the SVG is free; Pro adds downloads as PNG or SVG and an AI that writes the Mermaid from a plain-English description. It runs Mermaid 11.17.2, and every example on this page renders there as written.

## Limits

Every example was rendered on 29 November 2026 with Mermaid 12.3.0, the version in our editor, and with 11.17.2, the version in Mermaid Studio, in light and dark themes. The table reflects each tool's documentation as read on 29 November 2026; tools update their Mermaid on their own schedule.

## Sources

1. [GitHub Docs: Creating diagrams](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-diagrams)
2. [GitLab Docs: GitLab Flavored Markdown, Diagrams and flowcharts](https://docs.gitlab.com/user/markdown/)
3. [Obsidian Help: Advanced formatting syntax, Diagram](https://help.obsidian.md/advanced-syntax)
4. [Visual Studio Code: Markdown and Visual Studio Code](https://code.visualstudio.com/docs/languages/markdown)
5. [Mermaid documentation: Accessibility options](https://mermaid.js.org/config/accessibility.html)
6. [Mermaid documentation: Integrations](https://mermaid.js.org/ecosystem/integrations-community.html)
7. [Atlassian Marketplace: Mermaid Studio for Confluence (version 3.10.0)](https://marketplace.atlassian.com/apps/1011179388/mermaid-studio-ai-mermaid-diagram-editor)

## Questions and answers

### How do I add a Mermaid diagram to a GitHub README?

Write the diagram inside a fenced code block that starts with ````mermaid`. GitHub renders it when the file is viewed.

### Does VS Code need an extension for Mermaid?

Not for the preview: the built-in Markdown preview renders `mermaid` code blocks.

### Why does my Mermaid diagram work in the editor but not on GitHub?

The two probably run different Mermaid versions. A block containing only `info` shows the version GitHub uses.

### Can I link Obsidian notes from a Mermaid diagram?

Yes: add `class NodeA,NodeB internal-link;` and the nodes link to the notes with those names.

## How to cite

**Cite this as:** Going Stellar (2026). *Mermaid in Markdown: GitHub, GitLab, Obsidian and VS Code*. GOING STELLAR S.R.L.. https://goingstellar.ro/methods/mermaid-in-markdown-github-gitlab-obsidian-vscode/

```bibtex
@misc{goingstellar2026mermaid,
  title  = {Mermaid in Markdown: GitHub, GitLab, Obsidian and VS Code},
  author = {{Going Stellar}},
  year   = {2026},
  url    = {https://goingstellar.ro/methods/mermaid-in-markdown-github-gitlab-obsidian-vscode/},
  note   = {2026-11-29}
}
```

Licence. Free to quote with attribution.

## Also available

- This page as HTML: https://goingstellar.ro/methods/mermaid-in-markdown-github-gitlab-obsidian-vscode/
- Same article in Romanian: https://goingstellar.ro/ro/metode/diagrame-mermaid-in-markdown-github-gitlab-obsidian/
