legal-markdown-js
Version:
Node.js implementation of LegalMarkdown for processing legal documents with markdown and YAML - Complete feature parity with Ruby version
89 lines • 3.51 kB
TypeScript
/**
* Browser-Specific Entry Point for Legal Markdown Processing
*
* This module provides a browser-compatible version of the Legal Markdown
* processing library that excludes Node.js-specific features like file system
* operations and PDF generation. It's optimized for web environments and
* client-side processing.
*
* Features:
* - YAML front matter parsing and metadata extraction
* - Cross-reference processing and resolution
* - Optional clause conditional rendering
* - Mixin system for reusable content blocks
* - Header numbering and formatting
* - Field tracking for document highlighting
* - RST and LaTeX preprocessing support
* - UMD build compatibility for script tag usage
*
* @example
* ```typescript
* import { processLegalMarkdown } from 'legal-markdown-js/browser';
*
* // Browser-compatible document processing
* const result = processLegalMarkdown(content, {
* enableFieldTracking: true,
* noClauses: false
* });
*
* console.log(result.content); // Processed markdown
* console.log(result.metadata); // YAML front matter
* ```
*
* @module
*/
import { fieldTracker } from './extensions/tracking/field-tracker';
import { LegalMarkdownOptions } from './types';
declare function processLegalMarkdownWithRemark(content: string, options?: any): Promise<any>;
declare function processLegalMarkdownWithRemarkSync(content: string, options?: any): any;
/**
* Browser-compatible version of Legal Markdown processing
*
* This function provides the core Legal Markdown processing functionality
* optimized for browser environments. It excludes Node.js-specific features
* like file system operations while maintaining full compatibility with
* YAML parsing, content processing, and field tracking.
*
* @param {string} content - The raw Legal Markdown content to process
* @param {Omit<LegalMarkdownOptions, 'basePath' | 'exportPath'>} [options={}] - Browser-compatible configuration options
* @returns {Object} Processing result containing processed content, metadata, and reports
* @returns {string} returns.content - The processed document content
* @returns {Record<string, any>} [returns.metadata] - Extracted YAML metadata
* @returns {Object} [returns.fieldReport] - Field tracking report if enabled
* @example
* ```typescript
* const result = processLegalMarkdown(content, {
* enableFieldTracking: true,
* noClauses: false,
* noReferences: false
* });
*
* console.log(result.content); // Processed markdown
* console.log(result.metadata); // YAML front matter
* console.log(result.fieldReport); // Field usage report
* ```
*/
export declare function processLegalMarkdown(content: string, options?: Omit<LegalMarkdownOptions, 'basePath' | 'exportPath'>): {
content: string;
metadata?: Record<string, any>;
fieldReport?: ReturnType<typeof fieldTracker.generateReport>;
};
/**
* UMD-compatible export object for browser environments
*
* This object will be automatically exported by webpack as UMD.
* No manual window assignment needed - webpack handles this.
*
* @example
* ```typescript
* // UMD/Script tag usage
* const result = window.LegalMarkdown.processLegalMarkdown(content);
* ```
*/
declare const LegalMarkdown: {
processLegalMarkdown: typeof processLegalMarkdown;
processLegalMarkdownWithRemark: typeof processLegalMarkdownWithRemark;
processLegalMarkdownWithRemarkSync: typeof processLegalMarkdownWithRemarkSync;
};
export default LegalMarkdown;
//# sourceMappingURL=browser.d.ts.map