Support formatting of flag "reason" text

Feature description:

In addition to the standard flags raised by users and built-in automated systems (e.g., Discourse AI Spam Detection), Discourse allows forum administrators to implement custom systems that raise flags, including:

In order to facilitate review of these flags, it can be useful to provide supplemental information that will be displayed in the review item. This is supported by both the “Discourse Automation” and “Workflows” plugins.

Please add support for basic formatting of the “Reason” text as it is displayed in the review item.

:slightly_smiling_face: More complex information can be presented in a manner that improves its readability.

Current behavior:

The “Reason” text is always displayed all on a single line, despite all attempts to achieve different formatting via the source text.

:slightly_frowning_face: It is less efficient for moderators to read more complex information provided by the flag generation system.

Reproducible steps:

  1. Log into a Discourse forum account with admin permissions.
  2. Open the “Workflows” page (/admin/plugins/discourse-workflows/workflows).
  3. Click the “+ New workflow” button.
    A new workflow will be created.
  4. Click the + button.
    The “Add step” panel will open.
  5. Select Discourse actions > Flag post from the panel.
    A “Flag post” step will be added to the workflow.
  6. Double click on the “Flag post” step.
    The configuration dialog for the step will open.
  7. Set the “Post ID” field in the dialog to the ID of an arbitrary post.
  8. Add the following content to the “Reason” field:
    foo<br />bar
    
    baz  
    qux
    
    asdf\
    zxcv
    
  9. Close the step configuration dialog.
  10. Hover the mouse pointer over the “Flag post” step.
    Buttons will appear above the step.
  11. Click the button (“Execute step”) above the step.
  12. Navigate to the review queue (/review)

:slightly_frowning_face: The “Reason” text is displayed all on one line in the review item generated by the workflow, despite attempts to add line breaks using HTML, Markdown, and plain text formatting:

image

Discourse version:

ba63d427fd88c5d83cb18695b16dbdbfad6fa834

Additional context:

Formatting using HTML was supported in the past. I was only using the “Triage posts using AI” script of the “Discourse Automation” plugin at that time, as this was prior to the introduction of the “Workflows” plugin. It stopped working when my forum’s Discourse version was bumped from 6759ad71cac395697b2978eb34fcfbf1162d30d1 to a15f83133a8b30958fc09efcc407601299c22f37.

I looked through the changesets between those two versions, but was not able to identify the specific regression point.