Skip to content

Commit

Permalink
Merge branch 'release/v0.12.9'
Browse files Browse the repository at this point in the history
  • Loading branch information
holtwick committed Jan 8, 2024
2 parents 765cc8e + 7d56821 commit 6730de4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "zeed-dom",
"type": "module",
"version": "0.12.8",
"version": "0.12.9",
"description": "🌱 Lightweight offline DOM",
"author": {
"name": "Dirk Holtwick",
Expand Down
2 changes: 1 addition & 1 deletion src/index.browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ export { xml } from './xml'
export { handleHTML } from './manipulate'
export { serializeMarkdown } from './serialize-markdown'
export { serializePlaintext } from './serialize-plaintext'
export { serializeSafeHTML } from './serialize-safehtml'
export { serializeSafeHTML, safeHTML } from './serialize-safehtml'
5 changes: 5 additions & 0 deletions src/serialize-safehtml.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { escapeHTML } from './encoding'
import { VNode, isVElement } from './vdom'
import { parseHTML } from './vdomparser'

export const SELECTOR_BLOCK_ELEMENTS = 'p,h1,h2,h3,h4,h5,h6,blockquote,div,ul,ol,li,article,section,footer,nav,hr,form'

Expand Down Expand Up @@ -47,3 +48,7 @@ function serialize(node: VNode, context: SerializeContext = {
export function serializeSafeHTML(node: VNode): string {
return serialize(node).trim()
}

export function safeHTML(html: string) {
return serializeSafeHTML(parseHTML(html))
}

0 comments on commit 6730de4

Please sign in to comment.