azure-devopsmarkdowncommentscode-snippetscollapsable

How can I make a code section in the Azure DevOps comment collapsable?


How can I make a code section in the Azure DevOps comment collapsable?

I need this for the cases when I paste a lot of code or JSON. I tried two things.

First, I tried just clicking the Code button in the editor. It just adds the gray background, but does not make the section collapsable. enter image description here

Second thing I tried is to use the markdown. I put the following text:

<details open>
  <summary>Click to collapse</summary>

  var a = 2;
</details>

But saving the changes did not render any collapse controls. It just literally displayed the text I put. enter image description here

So, is there a way to add the collapsable code sections to the Azure DevOps ticket comments?


Solution

  • Microsoft explains how:

    A collapsible section with markdown

    <details>
      <summary>Click to expand!</summary>
    
      ## Heading
      1. A numbered
      2. list
         * With some
         * Sub bullets
    </details>
    

    Just follow this approach. It worked for me