MCPcopy Create free account
hub / github.com/ether/etherpad / dropEmptyBlocks

Function dropEmptyBlocks

src/node/utils/ExportSanitizeHtml.ts:110–118  ·  view source on GitHub ↗
(html: string)

Source from the content-addressed store, hash-verified

108// fidelity through html-to-docx.
109const EMPTY_BLOCK_RE = /<(h[1-6]|code|pre|div|blockquote)\b[^>]*>\s*<\/\1>/gi;
110export const dropEmptyBlocks = (html: string): string => {
111 let prev: string;
112 let cur = html;
113 do {
114 prev = cur;
115 cur = cur.replace(EMPTY_BLOCK_RE, '');
116 } while (cur !== prev);
117 return cur;
118};
119
120// Wrap loose text + inline content in `<p>` blocks so html-to-docx renders
121// `<br>` as a soft line break (`<w:br/>`) instead of a paragraph break

Callers 2

export.tsFile · 0.85
ExportHandler.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected