legal-markdown-js
Version:
Node.js implementation of LegalMarkdown for processing legal documents with markdown and YAML - Complete feature parity with Ruby version
97 lines • 3.38 kB
TypeScript
/**
* Header Processing Module for Legal Markdown Documents
*
* This module provides comprehensive header processing functionality for Legal Markdown
* documents, supporting both traditional (l., ll., lll.) and alternative (l2., l3.)
* header syntax. It handles complex numbering schemes, hierarchical structures, and
* various formatting options including Roman numerals, alphabetic labels, and custom
* indentation patterns.
*
* Features:
* - Dual header syntax support (traditional and alternative)
* - Complex hierarchical numbering with automatic level management
* - Roman numeral and alphabetic label generation
* - Customizable header formatting templates
* - Academic and legal document formatting patterns
* - Automatic indentation and spacing control
* - Continuous numbering and reset control options
* - Level-specific formatting with placeholder substitution
*
* @example
* ```typescript
* import { processHeaders } from './header-processor';
*
* const content = `l. Introduction
* ll. Terms and Conditions
* lll. Payment Terms
* l2. Liability`;
*
* const metadata = {
* 'level-one': 'Article %n.',
* 'level-two': 'Section %n.',
* 'level-three': '(%n)'
* };
*
* const processed = processHeaders(content, metadata);
* console.log(processed);
* // Output:
* // Article 1. Introduction
* // Section 1. Terms and Conditions
* // (1) Payment Terms
* // Section 2. Liability
* ```
*/
/**
* Processes structured headers in a LegalMarkdown document
*
* This is the main function that processes both traditional (l., ll., lll.) and
* alternative (l1., l2., l3.) header syntax. It maintains proper hierarchical
* numbering, applies custom formatting templates, and handles complex academic
* and legal document structures.
*
* @param {string} content - The document content containing headers to process
* @param {Record<string, any>} metadata - Document metadata with potential header formatting options
* @param {Object} [processingOptions={}] - Additional processing options
* @param {boolean} [processingOptions.noReset] - Disable header numbering reset (continuous numbering)
* @param {boolean} [processingOptions.noIndent] - Disable header indentation (flat formatting)
* @returns {string} Processed content with formatted headers
* @example
* ```typescript
* // Basic header processing
* const content = `l. First Article
* ll. First Section
* lll. Subsection A
* ll. Second Section
* l. Second Article`;
*
* const metadata = {
* 'level-one': 'Article %n.',
* 'level-two': 'Section %n.',
* 'level-three': '(%c)'
* };
*
* const result = processHeaders(content, metadata);
* // Output:
* // Article 1. First Article
* // Section 1. First Section
* // (a) Subsection A
* // Section 2. Second Section
* // Article 2. Second Article
*
* // Alternative syntax
* const altContent = `l1. Introduction
* l2. Background
* l3. Technical Details
* l2. Implementation
* l1. Conclusion`;
*
* const altResult = processHeaders(altContent, metadata);
* // Produces similar hierarchical numbering
* ```
*/
export declare function processHeaders(content: string, metadata: Record<string, any>, processingOptions?: {
noReset?: boolean;
noIndent?: boolean;
enableFieldTrackingInMarkdown?: boolean;
}): string;
//# sourceMappingURL=header-processor.d.ts.map