0

I'd like to include markdown diagrams in my project's source code. I'd also like to see them rendered in Azure DevOps when looking at source/pull-requests when I click on the Preview tab for the file.

md files are supported, but it seems mermaid diagrams are not. Is there a way to enable mermaid diagrams, or is there an alternative I can use that is supported?

Note: Not in the Wiki, in a file in with the source code repository.

1

I had this very same issue. Sadly in the code repos themselves you cannot view the rendered diagrams.

The diagrams (and only a few supported types are rendered) are only rendered in the "Wiki from code"

There is this extension in the VS Marketplace to render the .mmd mermaid files but that's not inline documentation with markdown.

There's also the issue that the syntax for mermaid diagrams in the markdown documents breaks traditional spec by using colons instead of backquotes:

:::mermaid
  graph TD;
    A-->B
:::

v.s.

```mermaid
  graph TD;
    A-->B
```

This wrecks many mermaid plugins in editors like VS Code when it comes to syntax highlighting language support. But thankfully that will actually still render in the markdown preview panes.

  • VSCode Mermaid Extensions
    • bierner.markdown-mermaid
      • render the diagrams
    • bpruitt-goddard.mermaid-markdown-syntax-highlighting
      • Syntax highlighting for mermaid code in code fences (not DevOps Colon syntax)

Some workaround for viewing mermaid diagrams in the markdown documents without being in the code wiki is the use of mermaid INK, with an issue I filed recently, they also updated the supported graph types on mermaid INK so now we can embed the diagrams that way and can get around the outdated version of mermaid that DevOps currently supports.

To use mermaid INK all you need to do is write your mermaid code in the I've editor and then grab the markdown link at the bottom of the editor and embed the diagram into your markdown document. This is a hack because now you lose out on version control of plain text diagram code, but the link to the image will take you back to the editor with an exact copy of the code you used to generate it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.