Stimulus & content

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 via options.from:)
  • Scale labels (under scale: or via scale.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:

CategoryTags
Structuraldiv, section, article, header, footer, main, nav, aside, figure, figcaption
Text & semanticsp, pre, code, blockquote, strong, b, em, i, u, span, small, sub, sup, mark, h1–h6, br, hr
Listsul, ol, li
Tablestable, thead, tbody, tfoot, tr, th, td, caption, colgroup, col
Links & mediaa, 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

TagAttributes
ahref, target, rel, download
imgsrc, alt, width, height, loading, decoding, referrerpolicy
videosrc, controls, muted, loop, preload, controlslist, poster, width, height, playsinline
audiosrc, controls, muted, loop, preload, controlslist
sourcesrc, type, media
tracksrc, kind, srclang, label, default
iframesrc, title, width, height, loading, allow, allowfullscreen, referrerpolicy, sandbox
buttontype, disabled, aria-label
blockquotecite
olstart, reversed, type
livalue
div / p / captionalign
tableborder, cellpadding, cellspacing, summary, width
tralign, valign
thcolspan, rowspan, scope, abbr, align, valign, width
tdcolspan, rowspan, align, valign, width
colgroupspan, width
colspan, 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:

ProtocolAllowed 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:

CodeCause
blocked-html-tagTag isn’t on the allowed-tag list. The whole element is removed; its surrounding content stays.
blocked-html-attributeAttribute isn’t allowed on this tag. The attribute is dropped; the tag stays.
blocked-html-protocolURL value uses a disallowed protocol (e.g. javascript:). The URL attribute is dropped.
blocked-html-styleCSS 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>
- 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 through text:. For embedded interactivity, see Custom HTML/JS.
  • Inline event handlers (onclick, onload, etc.) are stripped. They’re not in any per-tag allow-list.
  • autoplay on <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