Azure Devops Wiki MarkDown Multiple Lines in Table

8.3k Views Asked by At

I'm trying to generate automation release notes in MD format and working as well but when I am trying to insert the content to Azure DevOps Wiki the whole table is broken.

Here is my syntax, which I first process as a Handlebars template:

| PullRequst ID | Commit Message | Description |
| --- | --- | --- |
{{#forEach pullRequests}}
| [{{this.pullRequestId}}]| {{this.title}} |{{this.description}}|
{{/forEach}}

For PR-ID and Commit Message work as well, but for description can be multiple lines at the same time or full description of the commits. Tried with <br> tag and with <pre> not working.

PullRequst ID Commit Message Description
3183 Last Commit Message Fix commit message
Second Message to be stored here

How can I achieve this? Thanks

1

There are 1 best solutions below

3
On BEST ANSWER

Azure DevOps Markdown does support newlines in wiki tables:

To start a new line, use the HTML break tag (<br/>) (Works within a Wiki but not elsewhere)

Assuming you are really looking at a wiki and not something like a README, where newlines do not work in table cells, the problem is most likely that Handlebars is escaping your HTML <br> tag during pre-processing, turning it into something like &lt;br&gt;.

You can prevent this by using three braces instead of two for values that contain newlines, e.g.

{{{ this.description }}}

Note that this can be a security risk. I only recommend doing this if you have full control over the values you are using in your templates.