(node: Node, options: HTMLSerializerOptions = {})
| 52 | |
| 53 | export 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, |
no outgoing calls
no test coverage detected
searching dependent graphs…