H3 · Responses
vite-doctor/h3responsewarnSuggestion
Why it happens
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.
Fix
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>`
})
Verify the fix
Run only this rule after editing so the report stays focused on the diagnostic you are closing:
pnpm vite-doctor . --rules h3/response/no-html-plain-string