Skip to content

Markdown not rendering properly #2488

Closed

Description

@czardien

Hi,

I'm using d2 from the official Archlinux package: here, and I can't get markdown to render on my machine. I'm using pretty vanilla examples from the docs, and when I paste the same d2 code in the playground it renders properly.

I'm not sure if I'm missing a dependency or a configuration tweak or whatnot. I enabled debug logging but nothing jumps out to me. Can you please help with this?

Thank you!

Playground link: here.

SVG image from my machine:

Image

Debug logs on my machine:

$ d2 -d git.md.d2 && ristretto git.md.svg
debug: using theme Neutral Default (ID: 0)
2025-04-09T11:32:33+01:00 DEBUG default layout rootlevel=0 shapes=Objects: [start, git, report, git.explanation, ]
2025-04-09T11:32:33+01:00 DEBUG done rootlevel=0 shapes=Objects: [start, git, report, git.explanation, ]
debug: using layout plugin dagre (bundled)
success: successfully compiled git.md.d2 to git.md.svg in 277.23729ms

d2 version on my machine:

$ d2 --version
0.6.9

My d2 file:

direction: right

start -> git -> report

git: {
  explanation: |md
    ## How-to's

    Read user input:

    ```bash
    read -p "Enter fullname: " fullname
    ```
  |
}

report: |md
  # Report card

  - Computer science: B
  - Diagram making: A+
|

Activity

  1. czardien commented on Apr 9, 2025

    @czardien
    Author

    I've made tests with the official docker image and I'm also getting some interesting behaviour.

    When I run d2 with the --watch flag and I head to localhost:8080, I can actually see my markdown being rendered properly.

    $ docker run -it --rm -v $(pwd):/home/debian/src -u "$(id -u):$(id -g)" -p 127.0.0.1:8080:8080 docker.io/terrastruct/d2 --watch git.md.d2
    success: listening on http://[::]:8080
    info: compiling git.md.d2...
    success: successfully compiled git.md.d2 to git.md.svg in 210.092291ms
    

    Image

    However, when I ask d2 to compile to an SVG file, still with the docker image, the markdown is again missing from the resulting image.

    $ docker run -it --rm -v $(pwd):/home/debian/src -u "$(id -u):$(id -g)" -p 127.0.0.1:8080:8080 docker.io/terrastruct/d2 git.md.d2
    success: successfully compiled git.md.d2 to git.md.svg in 180.17671ms
    

    Image

  2. alfstorm commented on Nov 19, 2025

    @alfstorm

    I ran into this too (testing with both eog, loupe and inkscape), and I think it has to do with how SVG viewers render xhtml. From https://d2lang.com/tour/troubleshoot/:

    D2's Markdown support is added via xhtml foreign objects, which means the SVG viewer must have HTML rendering capabilities. The vast majority of SVG viewing is, but if you intend to use a pure SVG editor on D2 diagrams that don't have such capabilities (e.g. Adobe Illustrator), it won't render correctly there.

  3. alixander commented on Sep 3, 2026

    @alixander
    Collaborator

    Closing as resolved by #2866 and #2868: Markdown and raster output are now rendered natively, without Playwright or Chromium.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions