UNPKG

legal-markdown-js

Version:

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

65 lines 2.3 kB
/** * @fileoverview Document Validators for Legal Markdown * * This module provides validation functions for Legal Markdown documents to ensure * proper structure, syntax, and content integrity. These validators are extensions * beyond the core functionality that help identify potential issues before processing. * * Features: * - Document structure validation * - Syntax checking for brackets and braces * - Content integrity verification * - Error reporting with detailed messages * - Extensions not present in the original legal-markdown * - Validation rules for legal document conventions * * @example * ```typescript * import { validateDocumentStructure } from './validators.js'; * * // Validate document structure * const validation = validateDocumentStructure(content); * if (!validation.isValid) { * console.error('Document validation failed:'); * validation.errors.forEach(error => console.error(`- ${error}`)); * } * ``` */ /** * Validates document structure and content integrity * * Performs comprehensive validation of Legal Markdown document structure including * syntax checking, bracket matching, and content integrity verification. This is * an extension not present in the original legal-markdown specification. * * @function validateDocumentStructure * @param {string} content - The legal document content to validate * @returns {Object} Validation result object * @returns {boolean} returns.isValid - Whether the document passes all validation checks * @returns {string[]} returns.errors - Array of validation error messages * @example * ```typescript * import { validateDocumentStructure } from './validators.js'; * * const validation = validateDocumentStructure(documentContent); * * if (validation.isValid) { * console.log('Document structure is valid'); * } else { * console.error('Document validation failed:'); * validation.errors.forEach(error => { * console.error(`- ${error}`); * }); * } * * // Example validation errors: * // - Document cannot be empty * // - Unmatched optional clause brackets * // - Unmatched conditional braces * ``` */ export declare function validateDocumentStructure(content: string): { isValid: boolean; errors: string[]; }; //# sourceMappingURL=index.d.ts.map