Safe HTML
HTML markup is allowed inside any rendered text field — `text:`, `title:`, `instruction:`, option labels, scale labels, row labels. The platform sanitises every snippet against an allow-list of tags, attributes, and inline-style declarations. Disallowed content is dropped with a structured diagnostic, never silently stripped.
Where HTML is allowed
Every rendered-text field in the survey accepts HTML. The sanitiser runs on:
text:,title:,instruction:on every question- Option labels (under
options:or viaoptions.from:) - Scale labels (under
scale:or viascale.from:) - Row labels on grids
- Group labels
label.prefix/label.suffix
- qid: QGreeting
type: info
title: Welcome
text: |
Hi <b>{{ QName.value }}</b>! Today we'll ask about
<i>your shopping habits</i> over the last month.
Markup composes with Piping — {{ ... }}
substitutes runtime values, then the result passes through the
HTML sanitiser. Piped values are HTML-escaped first, so a
respondent’s typed answer can’t break out of the template.
Auto-detection: HTML vs plain text
The renderer decides whether to treat content as HTML or plain text by inspecting the content itself: if any allowed tag appears in the literal, the field renders as HTML; otherwise the content renders as plain text and angle brackets render as literals.
# Renders as HTML — <b> is an allowed tag, so the renderer
# parses the whole field as markup.
- qid: QGreeting
type: info
text: |
Welcome <b>back</b>!
# Renders as plain text — no allowed tag in the literal, so
# the < and > render as literals.
- qid: QInstruction
type: info
text: |
Wrap the result in <pre> tags before submitting.
Auto-detection is good enough for almost every survey. If you need fine control, just stick to the allow-list and the behaviour is predictable.
The allowed-tag allow-list
The full inventory of tags the sanitiser accepts:
| Category | Tags |
|---|---|
| Structural | div, section, article, header, footer, main, nav, aside, figure, figcaption |
| Text & semantics | p, pre, code, blockquote, strong, b, em, i, u, span, small, sub, sup, mark, h1–h6, br, hr |
| Lists | ul, ol, li |
| Tables | table, thead, tbody, tfoot, tr, th, td, caption, colgroup, col |
| Links & media | a, button, img, audio, video, source, track, iframe |
Anything not on the list is dropped — the surrounding content
survives, the offending element is removed, and a
blocked-html-tag diagnostic appears in the platform’s
diagnostics panel.
Allowed attributes
Global attributes (any tag)
class id title role style
aria-* data-*
Per-tag attribute lists
| Tag | Attributes |
|---|---|
a | href, target, rel, download |
img | src, alt, width, height, loading, decoding, referrerpolicy |
video | src, controls, muted, loop, preload, controlslist, poster, width, height, playsinline |
audio | src, controls, muted, loop, preload, controlslist |
source | src, type, media |
track | src, kind, srclang, label, default |
iframe | src, title, width, height, loading, allow, allowfullscreen, referrerpolicy, sandbox |
button | type, disabled, aria-label |
blockquote | cite |
ol | start, reversed, type |
li | value |
div / p / caption | align |
table | border, cellpadding, cellspacing, summary, width |
tr | align, valign |
th | colspan, rowspan, scope, abbr, align, valign, width |
td | colspan, rowspan, align, valign, width |
colgroup | span, width |
col | span, width |
Attributes not on the per-tag list (or not in the global list)
are stripped with a blocked-html-attribute diagnostic. The
tag itself survives.
style="..." is the gateway to inline CSS — the content of
the style attribute is sanitised separately (see
Inline CSS).
Allowed URL protocols
Any attribute that takes a URL — href, src, poster,
cite — is checked against an allow-list of protocols:
| Protocol | Allowed on |
|---|---|
https:// | every URL attribute |
http:// | every URL attribute |
mailto: | a[href] |
tel: | a[href] |
sms: | a[href] |
blob: | URL attributes |
data:image/* | img[src], picture source |
data:audio/* | audio[src], audio source |
data:video/* | video[src], video source |
<iframe src="..."> is stricter — only relative URLs and
https:// URLs render. Anything else (a data: URL, an
http:// link to a page) is dropped with a
blocked-html-protocol diagnostic.
javascript: URLs are always rejected. So is anything with a
javascript: substring buried inside a data: URL.
What’s stripped vs what raises
The sanitiser runs at render time. Disallowed content is always dropped — never silently. Each rejection fires a structured diagnostic the platform’s diagnostics panel surfaces. Diagnostic codes:
| Code | Cause |
|---|---|
blocked-html-tag | Tag isn’t on the allowed-tag list. The whole element is removed; its surrounding content stays. |
blocked-html-attribute | Attribute isn’t allowed on this tag. The attribute is dropped; the tag stays. |
blocked-html-protocol | URL value uses a disallowed protocol (e.g. javascript:). The URL attribute is dropped. |
blocked-html-style | CSS declaration in a style="..." attribute uses a disallowed property or value. See Inline CSS. |
The respondent never sees these diagnostics — they appear only in the editor / diagnostics panel during authoring and testing. In production, sanitisation still runs; the diagnostic just goes nowhere visible to the respondent.
Common patterns
Emphasis with <b> / <i> / <u>
The everyday formatting tags. Combine freely with piping.
- qid: QGreeting
type: info
text: |
Welcome back, <b>{{ QName.value }}</b>. You last
visited on <i>{{ QLastSeen.value }}</i> and your
status is <u>{{ QStatus.selectedLabel }}</u>.
Lists
- qid: QInstructions
type: info
title: How this survey works
text: |
<ul>
<li>About <b>15 minutes</b> in total</li>
<li>You can pause and resume at any time</li>
<li>All answers are <i>confidential</i></li>
</ul>
A link
- qid: QPrivacy
type: info
text: |
See our <a href="https://example.com/privacy" target="_blank" rel="noopener">privacy policy</a> before starting.
target="_blank" is allowed; pair with rel="noopener" to
opt out of the leaked-window-handle behaviour.
A heading inside text
- qid: QSection
type: info
text: |
<h3>Section 2 of 4</h3>
<p>Now we'll ask about your usage habits.</p>
title: already renders as the question heading, but <h2> /
<h3> inside text: is fine for sub-headings within longer
copy.
A small table
- qid: QPriceList
type: info
text: |
<table>
<thead>
<tr><th>Tier</th><th>Monthly</th><th>Annual</th></tr>
</thead>
<tbody>
<tr><td>Basic</td><td>$10</td><td>$100</td></tr>
<tr><td>Pro</td><td>$25</td><td>$250</td></tr>
</tbody>
</table>
What you can’t do
<script>is blocked — there’s no way to add custom JS throughtext:. For embedded interactivity, see Custom HTML/JS.- Inline event handlers (
onclick,onload, etc.) are stripped. They’re not in any per-tag allow-list. autoplayon<video>/<audio>is rejected. The attribute is allow-listed structurally but blocked at render time — a diagnostic fires telling you to add user-initiated controls.- Form elements (
<input>,<form>,<select>, etc.) are not allowed. Survey UI is generated by the platform from the question type — author HTML is for stimulus, not competing inputs.
See also
- Piping —
{{ ... }}substitution composes with HTML markup; piped values are HTML-escaped automatically - Inline CSS — what’s allowed inside
style="..."attributes - Media — embedding images, audio, video via
<img>/<video>/<audio> - Custom HTML/JS — the escape hatch for arbitrary HTML + JavaScript on a single question