Legal Markdown JS supports multiple output formats with professional styling, highlighting, and customization options for legal and business documents.
Generate professional PDF documents with custom styling and branding.
- PDF Options - Page formats, orientation, margins
- Logo Integration - Automatic logo detection and embedding
- Headers/Footers - Custom templates with page numbers
- Template Helpers - Programmatic PDF generation tools
Example:
legal-md contract.md --pdf --css ./styles/legal.css --highlightCreate responsive HTML documents with interactive features.
- Custom Templates - Full HTML template control
- CSS Integration - External and inline styling
- Responsive Design - Mobile-friendly layouts
- Interactive Features - JavaScript integration, tooltips
Example:
legal-md document.md --html --highlight --css ./styles/responsive.cssGenerate native Word documents with CSS-to-style mapping.
- Word-Compatible Output -
.docxpackages ready for Office/LibreOffice - Style Mapping -
default.css/highlight.cssmapped to DOCX paragraph/run styles - Document Classes - Support for
.confidential,.separator,.algorithm,.signatures,.table-of-contents - List + Break Mapping -
list-style-typeandpage-break-before/afteradaptation - Headers/Footers - Version + page numbers + optional logo, or custom API templates
- Highlight Variants - Optional
.HIGHLIGHT.docxreviewer copy - Pipeline Reuse - Same 3-phase processing path as HTML/PDF
Example:
legal-md contract.md --docx --highlight --css ./styles/legal.cssVisual indicators for template field status and data validation.
- Color Coding - Blue (filled), Red (missing), Yellow (complex)
- Field Tracking - Comprehensive field processing reports
- Review Workflow - Document completeness validation
- Custom Styling - Configurable highlight appearance
Example:
const result = await processLegalMarkdown(content, {
enableFieldTracking: true,
});
console.log(result.fieldReport); // Detailed field analysisComplete reference for styling and customization.
- Legal Header Classes - Semantic legal document structure
- Field Review Classes - Template variable highlighting
- Formatting Classes - Document layout and typography
- Custom Styling - Override default appearances
Example:
.legal-header-level-1 {
/* Article headers */
}
.imported-value {
/* Successfully filled fields */
}
.missing-value {
/* Fields requiring data */
}# Generate all formats simultaneously
legal-md contract.md --pdf --html --docx --highlight --css ./styles/legal.css
# Output:
# - contract.pdf (PDF with highlighting)
# - contract.html (HTML with highlighting)
# - contract.docx (normal DOCX)
# - contract.HIGHLIGHT.pdf (Highlighted PDF version)
# - contract.HIGHLIGHT.docx (Highlighted DOCX version)import {
generatePdf,
generateHtml,
generateDocx,
generateDocxVersions,
processLegalMarkdown,
} from 'legal-markdown-js';
// Generate PDF
const pdfBuffer = await generatePdf(content, 'contract.pdf', {
cssPath: './styles/legal.css',
includeHighlighting: true,
format: 'A4',
});
// Generate HTML
const html = await generateHtml(content, {
title: 'Service Agreement',
cssPath: './styles/responsive.css',
includeHighlighting: true,
});
// Generate DOCX
const docxBuffer = await generateDocx(content, 'contract.docx', {
title: 'Service Agreement',
cssPath: './styles/legal.css',
includeHighlighting: true,
headerTemplate: '<p class="text-center">ACME</p>',
footerTemplate: '<p class="text-center text-muted">Internal</p>',
});
// Generate both normal and highlight DOCX versions
const docxVersions = await generateDocxVersions(content, 'contract.docx', {
title: 'Service Agreement',
cssPath: './styles/legal.css',
});
console.log(docxVersions.normal.length, docxVersions.highlighted.length);
// Get field tracking report
const result = await processLegalMarkdown(content, {
enableFieldTracking: true,
});
console.log(
`Document ${(result.fieldReport.filled / result.fieldReport.total) * 100}% complete`
);- Features Overview - Core Legal Markdown features
- Helper Functions - Template formatting helpers
- Smart Archiving - Automatic file management
- Force Commands - Self-configuring documents