UNPKG

legal-markdown-js

Version:

Node.js implementation of LegalMarkdown for processing legal documents with markdown and YAML - Complete feature parity with Ruby version

61 lines 2.11 kB
/** * Remark plugin for Legal Markdown date processing * * This plugin processes date references in Legal Markdown documents using * AST-based processing. It handles @today tokens with format specifiers and * arithmetic operations, integrating with the comprehensive date helper system. * * Features: * - @today token processing with format specifiers (@today[format]) * - Date arithmetic with +/- operations (@today+30, @today-365) * - Advanced date formatting (legal, ISO, US, European, etc.) * - Timezone and locale support * - Integration with field tracking for highlighting * - Comprehensive error handling with fallback formatting * * Architecture: * 1. Scan document content for @today patterns * 2. Parse format specifiers and arithmetic operations * 3. Process dates using advanced date helpers * 4. Replace tokens with formatted dates * 5. Integrate with field tracker for highlighting support * * @example * ```typescript * import { unified } from 'unified'; * import remarkParse from 'remark-parse'; * import remarkDates from './dates'; * * const processor = unified() * .use(remarkParse) * .use(remarkDates, { * metadata: { 'date-format': 'legal', timezone: 'America/New_York' }, * enableFieldTracking: true * }); * * const result = await processor.process('Contract signed on @today[legal].'); * // Result: "Contract signed on January 15th, 2024." * ``` * * @module */ import type { Plugin } from 'unified'; import type { Root } from 'mdast'; /** * Plugin options for date processing */ interface DateProcessingOptions { /** Document metadata containing date formatting options */ metadata: Record<string, any>; /** Enable debug logging */ debug?: boolean; /** Enable field tracking with highlighting during AST processing */ enableFieldTracking?: boolean; } /** * Remark plugin for processing date references in Legal Markdown documents */ declare const remarkDates: Plugin<[DateProcessingOptions], Root>; export default remarkDates; export type { DateProcessingOptions }; //# sourceMappingURL=dates.d.ts.map