Rendering code in user prompts on Chat UI — Unique AI Documentation

Rendering code in user prompts on Chat UI

Overview

This documentation explains how to include code snippets in your own messages in Chat. The Chat UI renders user prompts as Markdown — wrap code in backticks to display it correctly.

Who is it for

This feature is designed for:

Benefits

Use Cases

Supported code syntax

Use standard Markdown backtick formatting only:

Optional: Add a language name after the opening fence for syntax highlighting, e.g. ``````python```.

Step-by-Step Guide

To render code in your Chat prompt, use Markdown backtick syntax.

Key Points

  1. Inline code:
    • Wrap short snippets in a pair of single backticks: myVariable.
  2. Code blocks:
    • Open with on its own line, paste your code, then close with on a new line.
  3. Special characters:
    • Keep <, >, and & inside backticks so they display correctly.

Examples

Inline command

Run `npm install` and then `npm start`.

Single-line code

What does `const x = arr.filter(n => n > 0);` do?

Multi-line block

Explain the following code:
```
SELECT id, name
FROM users
WHERE active = true;
```

Code with angle brackets

Why does this fail? `<div class="item">` is not closing properly.

Code block with language tag

```python
def add(a, b):
    return a + b
```

Tips & Tricks

Limitations

Code is only rendered reliably when you use the backtick formatting above. If you paste code as plain text (without backticks), correct rendering cannot be guaranteed — formatting, line breaks, and special characters may appear wrong.