developit / htm

Hyperscript Tagged Markup: JSX alternative using standard tagged templates, with compiler support.
Apache License 2.0
8.73k stars 170 forks source link

How to achieve static raw compiled HTML as a string -> htm without template strings? #219

Closed brandonros closed 2 years ago

brandonros commented 2 years ago

Example:

const generateHtml = () => {
  let html = ''
  html += '<p>Hello, world!</p>' // usually a lot of weird logic like dynamic table building here, this is just a short example
  return html
}

const rawHtml = generateHtml()
htm`${rawHtml}` // does not do what is expected
brandonros commented 2 years ago

duplicate of https://github.com/developit/htm/issues/137