Skip to main content

html

html(raw, ...values): string

A tagged template that interprets different kinds of values into escaped HTML.

ts
const template = html`
<div hx-vals=${{ foo: 'bar' }} />
`;
assertEqual(template, `<div hx-vals='{"foo":"bar"}' />`);
ts
const template = html`
<div hx-vals=${{ foo: 'bar' }} />
`;
assertEqual(template, `<div hx-vals='{"foo":"bar"}' />`);

Parameters

raw: TemplateStringsArray

• ...values: InterpValue[]

Returns

string

Source

src/index.ts:113