Skip to content
Nuvexa AI
Menu
Coding · PRACTICAL TUTORIAL

Render assistant formatting without exposing raw HTML

Formatting should make the text readable without treating arbitrary provider output as trusted markup. Code samples also need predictable layout.

Published by Nuvexa AI · Published · 2 min read

Start here

This example uses the sample details below. Replace them with your own facts before applying the instructions.

  • Assistant replies contain headings and emphasis; HTML input is untrusted.

Start with the facts

Assistant replies contain headings and emphasis; HTML input is untrusted. Keep a small reproducible example and the expected behavior. Remove secrets from the code or error message before requesting help.

Spot the problem

The wording or action to avoid is: “Insert every reply as raw HTML.” Formatting should make the text readable without treating arbitrary provider output as trusted markup. Code samples also need predictable layout.

Make the correction

Use a Markdown renderer with an appropriate supported syntax policy and review how links and code blocks are displayed.

Check before using the result

Check headings, lists, code fences, long lines and untrusted HTML; confirm the output remains readable and does not execute markup.

Worked example and reusable input

Use the stated inputs to reproduce checked local outputs. Replace sample facts when applying a brief to your own work.

TASK
Render assistant formatting without exposing raw HTML

SAMPLE INPUT — replace with your actual facts
Assistant replies contain headings and emphasis; HTML input is untrusted.

AVOID
Insert every reply as raw HTML.

CORRECTED APPROACH
Use a Markdown renderer with an appropriate supported syntax policy and review how links and code blocks are displayed.

ACCEPTANCE CHECK
Check headings, lists, code fences, long lines and untrusted HTML; confirm the output remains readable and does not execute markup.

Key takeaways

  • Formatting should make the text readable without treating arbitrary provider output as trusted markup. Code samples also need predictable layout.
  • Check headings, lists, code fences, long lines and untrusted HTML; confirm the output remains readable and does not execute markup.