I've noticed a peculiar behavior in Azure DevOps regarding the Description field of elements. I add some content that is structured within div containers with various IDs and classes automatically via a program with REST API. However, if I add content manually to the Description field in Azure DevOps, the entire HTML structure gets altered. The IDs and classes of the divs are removed, and the style information contained within a style tag is added as attributes to individual elements.
Automatic Input:
<div id="automaticInput">
<div class="category">Category 1: </div><br>
<table>
<tr>
<td class="text">Some information about the item. </td>
<td class="comment"> </td>
</tr>
</table><br>
</div>
<style>
/*Some style*/
</style>
When I add some text manually to it in Azure:
<div>
<div>Category 1: </div><br>
<table style="border-collapse:collapse;width:100%;table-layout:fixed;">
<tbody>
<tr>
<td style="vertical-align:top;text-align:left;width:80%;padding:10px;">Some
information about the item.
<br>Some new changes </td>
<td
style="vertical-align:top;text-align:left;padding:10px;border:1px solid
rgb(221, 221, 221);background-color:beige;width:20%;">
</td>
</tr>
</tbody>
</table><br>
</div>
I'm curious about the rules or criteria Azure DevOps follows when making these alterations. Is there a way to prevent this from happening, or are there guidelines I should follow to ensure consistent HTML structure in the Description field?
Based on your description, I added a comment for a work item via API with some simple format like in the PowerShell script below. I then got that new comment and noticed the
id=automaticInputandstylewere indeed kept in the response; still the custom styling was not refected in the web UI.When editing this comment in the Web UI, we could check the request sent by the browser developer tool (F12) didn't convey the
id=automaticInputandstylesections in the payload.It seems that the Azure DevOps work item comment field doesn't support such html styling for the web UI.