
Product
Reachability for Ruby Now in Beta
Reachability analysis for Ruby is now in beta, helping teams identify which vulnerabilities are truly exploitable in their applications.
async-htm-to-string
Advanced tools
Renders a htm tagged template asyncly into a string.
npm install async-htm-to-string
const { html, renderToString } = require('async-htm-to-string');
const customTag = ({ prefix }, children) => html`<div>${prefix}-${children}</div>`;
const dynamicContent = 'bar';
// Will equal "<div>foo-bar</div>
const result = await renderToString(html`<${customTag} prefix="foo">${dynamicContent}</${customTag}>`);
htmlIs h() bound to htm (htm.bind(h)). Used with template literals, like:
const renderableElement = html`<div>${content}</div>`;
rawHtml / rawHtml(rawString)If you need to provide pre-escaped raw HTML content, then you can use rawHtml as either a template literal or by calling it with the
const renderableElement = rawHtml`<div>&${'"'}</div>`;
const renderableElement = rawHtml('<div>&</div>');
You can also use the result of any of those rawHtml inside html, like:
const renderableElement = html`<div>${rawHtml`&`}</div>`;
h(type, props, ...children)The inner method that's htm is bound to.
render(renderableElement)Takes the output from html and returns an async iterator that yields the strings as they are rendered
renderToString(renderableElement)Same as render(), but asyncly returns a single string with the fully rendered result, rather than an async iterator.
generatorToString(somethingIterable)Asyncly loops over an iterable (like eg. an async iterable) and concatenates together the result into a single string that it resolves to. The brains behind renderToString().
FAQs
Renders a htm tagged template asyncly into a string
We found that async-htm-to-string demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Reachability analysis for Ruby is now in beta, helping teams identify which vulnerabilities are truly exploitable in their applications.

Research
/Security News
Malicious npm packages use Adspect cloaking and fake CAPTCHAs to fingerprint visitors and redirect victims to crypto-themed scam sites.

Security News
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.