/** * Bridge between the Quill editor (HTML) and the stored article body, which is * the structural plain text the server parses into numbered clauses * (`parseArticleBody` in contract-article.util.ts): one clause per line, a * leading outline token ("2.", "2.1") for depth, and "- " for bullets. * * Quill owns presentation; the body format owns structure. Converting on the * way in and out keeps the renderer, the server-side renumbering, and the * generated PDF working exactly as before. */ const ESCAPES: Record = { "&": "&", "<": "<", ">": ">", }; const escapeHtml = (text: string): string => text.replace(/[&<>]/g, (c) => ESCAPES[c]); /** * Body text → Quill HTML. Clauses become `

` carrying their outline token so * the author sees the real numbering; bullets become a `

"); return out.join(""); } /** * Quill HTML → body text. `
  • ` inside a `