markdig icon indicating copy to clipboard operation
markdig copied to clipboard

Azure devops support

Open ProCoderMatt opened this issue 3 years ago • 4 comments

Hi! I saw this issue and wanted to mention it here. https://github.com/madskristensen/MarkdownEditor2022/issues/46

I'm writing my docs in visual studio and use the Azure DevOps wiki to read my docs. When I'm trying to create a mermaid diagram I use the ``` mermaid. But on the devops wiki it need to start with ::: mermaid. Can we support ::: for mermaid diagrams so we can see the diagram both in visual studio and Azure DevOps?

Thanks!

ProCoderMatt avatar Aug 15 '22 11:08 ProCoderMatt

Not sure how Azure DevOps is working for :::, but markdig supports Custom Containers :::. Might be enough?

xoofx avatar Aug 15 '22 11:08 xoofx

Thanks for your quick response.

I looked into the custom containers and I found that the below converts to html that throws an exception in mermaid.js

::: mermaid
  graph LR
:::

I think it's because the custom container adds <p> element for each line.

<div class="mermaid">
    <p id="pragma-line-2">graph LR</p>
</div>

We need to dump the text between the colons without any tags.

ProCoderMatt avatar Aug 15 '22 13:08 ProCoderMatt

Oh, right, so it's a fenced code block with a different escape.

There is nothing built-in. You will have to create an extension/modify the pipeline to e.g add the : to the OpeningCharacters of the existing FencedCodeBlockParser and modify the associated renderer to add mermaid here (Edit: And also, you should not enable the Custom Container extension to avoid the conflict)

xoofx avatar Aug 15 '22 14:08 xoofx

Hi xoofx,

Thanks for your answer!

When I have time I will create a PR :)

ProCoderMatt avatar Aug 22 '22 08:08 ProCoderMatt