legal-markdown-js
Version:
Node.js implementation of LegalMarkdown for processing legal documents with markdown and YAML - Complete feature parity with Ruby version
114 lines • 3.56 kB
TypeScript
/**
* Core constants for Legal Markdown processing
*
* This module contains fundamental constants for document processing,
* including default options, supported formats, and error codes.
*/
/**
* Default options for Legal Markdown processing
* @example
* ```typescript
* import { DEFAULT_OPTIONS } from './constants.js';
*
* // Use default options
* const options = { ...DEFAULT_OPTIONS, debug: true };
*
* // Override specific options
* const customOptions = {
* ...DEFAULT_OPTIONS,
* yamlOnly: true,
* exportMetadata: true,
* exportFormat: 'json' as const
* };
* ```
*/
export declare const DEFAULT_OPTIONS: {
/** Process only YAML frontmatter, skip content processing */
yamlOnly: boolean;
/** Skip processing of header structures */
noHeaders: boolean;
/** Skip processing of optional clauses */
noClauses: boolean;
/** Skip processing of cross-references */
noReferences: boolean;
/** Skip processing of import statements */
noImports: boolean;
/** Export metadata to external files */
exportMetadata: boolean;
/** Format for metadata export */
exportFormat: "yaml";
/** Enable debug logging */
debug: boolean;
/** Throw errors on YAML parsing failures */
throwOnYamlError: boolean;
};
/**
* Supported file formats for input and export operations
* @example
* ```typescript
* import { SUPPORTED_FORMATS } from './constants.js';
*
* // Check if format is supported for export
* const isExportSupported = SUPPORTED_FORMATS.EXPORT.includes('yaml');
*
* // Check if input format is supported
* const isInputSupported = SUPPORTED_FORMATS.INPUT.includes('md');
* ```
*/
export declare const SUPPORTED_FORMATS: {
/** Supported export formats */
readonly EXPORT: readonly ["yaml", "json"];
/** Supported input formats */
readonly INPUT: readonly ["md", "markdown"];
};
/**
* File extensions for different document types
* @example
* ```typescript
* import { FILE_EXTENSIONS } from './constants.js';
*
* // Check if file is markdown
* const isMarkdown = FILE_EXTENSIONS.MARKDOWN.includes(path.extname(filename));
*
* // Check if file is YAML
* const isYaml = FILE_EXTENSIONS.YAML.includes(path.extname(filename));
* ```
*/
export declare const FILE_EXTENSIONS: {
/** Markdown file extensions */
readonly MARKDOWN: readonly [".md", ".markdown"];
/** YAML file extensions */
readonly YAML: readonly [".yml", ".yaml"];
/** JSON file extensions */
readonly JSON: readonly [".json"];
};
/**
* Error codes for consistent error handling throughout the system
* @example
* ```typescript
* import { ERROR_CODES } from './constants.js';
*
* // Use error codes in custom errors
* throw new Error(ERROR_CODES.YAML_PARSING_ERROR);
*
* // Check error codes in error handling
* if (error.code === ERROR_CODES.FILE_NOT_FOUND) {
* // Handle file not found error
* }
* ```
*/
export declare const ERROR_CODES: {
/** YAML parsing error code */
readonly YAML_PARSING_ERROR: "YAML_PARSING_ERROR";
/** File not found error code */
readonly FILE_NOT_FOUND: "FILE_NOT_FOUND";
/** Import processing error code */
readonly IMPORT_PROCESSING_ERROR: "IMPORT_PROCESSING_ERROR";
/** Metadata export error code */
readonly METADATA_EXPORT_ERROR: "METADATA_EXPORT_ERROR";
/** Validation error code */
readonly VALIDATION_ERROR: "VALIDATION_ERROR";
/** General processing error code */
readonly PROCESSING_ERROR: "PROCESSING_ERROR";
};
//# sourceMappingURL=core.d.ts.map