H3 · H30013

Use the html tagged template for markup

Flags html() called with a plain string that contains markup.
H30013vite-doctor/h3responsewarnSuggestion

Run this rule

pnpm vite-doctor . --rules h3/response/no-html-plain-string

Why it matters

Since H3 2.0.1-rc.26, html() escapes a plain string argument, so markup passed as a string is rendered as text. Only the html`` tagged template and raw() keep trusted markup.

Use the tagged template html<h1>`${title}`</h1>, which escapes interpolated values, or wrap trusted markup with raw().

Example

Use the html tagged template

Before

export default defineHandler(() => {
  return html("<h1>Hello</h1>")
})

After

export default defineHandler(() => {
  return html`<h1>Hello</h1>`
})
Copyright © 2026