MCPcopy Create free account
hub / github.com/editablejs/editable / transform

Function transform

packages/serializer/src/html.ts:54–68  ·  view source on GitHub ↗
(node: Node, options: HTMLSerializerOptions = {})

Source from the content-addressed store, hash-verified

52
53export const HTMLSerializer = {
54 transform(node: Node, options: HTMLSerializerOptions = {}): string {
55 const { attributes, style } = options
56 if (Text.isText(node)) return TextSerializer.transform(node)
57 const { children } = node
58 const html = children.map(child => this.transform(child)).join('')
59 if (Editor.isEditor(node)) return html
60 const { type } = node
61 let nodeName = type ?? 'p'
62 switch (type) {
63 case 'paragraph':
64 nodeName = 'p'
65 break
66 }
67 return this.create(nodeName, attributes, style, html)
68 },
69
70 create(
71 tag: string,

Callers 1

withFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…