legal-markdown-js
Version:
Node.js implementation of LegalMarkdown for processing legal documents with markdown and YAML - Complete feature parity with Ruby version
54 lines • 2.06 kB
TypeScript
/**
* Shared HTML Formatting Utilities
*
* Browser-compatible module that provides the single source of truth for:
* - Markdown → HTML conversion (marked.js configuration)
* - HTML beautification (js-beautify configuration)
* - Full HTML document wrapper
*
* Used by both the Node pipeline (html-generator.ts) and the browser bundle
* (browser-modern.ts / playground). This ensures identical output regardless
* of the execution environment.
*
* @module utils/html-format
*/
/**
* Configure marked.js for legal document rendering.
*
* Call once at startup. Idempotent - safe to call multiple times.
* Applies the same settings used by the Node HTML generator so that
* browser and server produce identical HTML from the same markdown.
*/
export declare function configureMarkedForLegal(): void;
/**
* Convert a markdown string to an HTML body fragment.
*
* Uses the shared marked configuration (GFM, breaks, legal renderer).
* The output is a raw HTML string - call {@link formatHtml} to prettify.
*
* @param markdown - Processed legal markdown (after template substitution)
* @returns HTML body fragment (no `<html>`/`<head>` wrapper)
*/
export declare function markdownToHtmlBody(markdown: string): string;
/**
* Prettify an HTML string using the shared js-beautify configuration.
*
* Safe for both fragments and full documents.
*
* @param html - Raw HTML string
* @returns Formatted HTML with consistent indentation
*/
export declare function formatHtml(html: string): string;
/**
* Wrap an HTML body fragment in a complete HTML5 document.
*
* Produces a self-contained document that can be opened directly in a
* browser or used for PDF generation.
*
* @param body - HTML body content
* @param css - CSS to embed in `<style>` (empty string for no styles)
* @param title - Document `<title>` value
* @returns Complete HTML document string, formatted with js-beautify
*/
export declare function wrapHtmlDocument(body: string, css: string, title: string): string;
//# sourceMappingURL=html-format.d.ts.map