legal-markdown-js
Version:
Node.js implementation of LegalMarkdown for processing legal documents with markdown and YAML - Complete feature parity with Ruby version
63 lines • 2.11 kB
JavaScript
/**
* Plugin metadata system for remark plugins
*
* This module defines interfaces for declaring plugin dependencies and execution order.
* It helps prevent plugin ordering bugs by making dependencies explicit and validatable.
*
* @module plugins/remark/types
*/
/**
* Processing phases for the Legal Markdown pipeline
*
* Plugins execute in phase order (1 → 2 → 3 → 4 → 5).
* Within each phase, plugins are ordered by dependency constraints.
*
* @example
* ```typescript
* const plugin: PluginMetadata = {
* name: 'remarkMixins',
* phase: ProcessingPhase.VARIABLE_EXPANSION,
* description: 'Expand variable patterns',
* };
* ```
*/
export var ProcessingPhase;
(function (ProcessingPhase) {
/**
* Phase 1: Content Loading
* - Load all imports and external content
* - Merge metadata from imported files
* - NO transformations, just aggregation
*/
ProcessingPhase[ProcessingPhase["CONTENT_LOADING"] = 1] = "CONTENT_LOADING";
/**
* Phase 2: Variable Expansion
* - Expand {{variable}} patterns from metadata
* - Process mixins and template fields
* - BEFORE conditionals evaluate
*/
ProcessingPhase[ProcessingPhase["VARIABLE_EXPANSION"] = 2] = "VARIABLE_EXPANSION";
/**
* Phase 3: Conditional Evaluation
* - Evaluate {{#if}}, {{#unless}}, {{#each}}
* - Process template loops
* - AFTER variables expanded
*/
ProcessingPhase[ProcessingPhase["CONDITIONAL_EVAL"] = 3] = "CONDITIONAL_EVAL";
/**
* Phase 4: Structure Parsing
* - Parse legal headers (l., ll., lll.)
* - Number headers and build cross-references
* - Structural transformations
*/
ProcessingPhase[ProcessingPhase["STRUCTURE_PARSING"] = 4] = "STRUCTURE_PARSING";
/**
* Phase 5: Post-Processing
* - Date formatting
* - Signature lines
* - Field tracking and highlighting
* - Final cleanup
*/
ProcessingPhase[ProcessingPhase["POST_PROCESSING"] = 5] = "POST_PROCESSING";
})(ProcessingPhase || (ProcessingPhase = {}));
//# sourceMappingURL=types.js.map