/** * Markdown Table Parser * * Parses Markdown tables into structured data. * * Supports: * - Standard GFM (GitHub Flavored Markdown) table syntax * - Column alignment detection via separator row * - Escaped pipes (`\|`) in cell content * - Tables with or without leading/trailing pipes * - Tolerant parsing (mismatched column counts, extra whitespace) * - Multiline cell content via `
` / `
` / `
` tags * * @example * ```ts * const result = parseMarkdown("| Name | Age |\n| --- | --- |\n| Alice | 30 |"); * // result.headers = ["Name", "Age"] * // result.rows = [["Alice", "30"]] * // result.alignments = ["none", "none"] * ``` */ import type { MarkdownParseOptions, MarkdownParseResult } from "../types.js"; /** * Parse a Markdown table string into structured data. * * The parser looks for the GFM table pattern: * 1. A header row (pipe-delimited cells) * 2. A separator row (dashes with optional colons for alignment) * 3. Zero or more data rows * * Non-table content before and after the table is ignored. * * @param input - Markdown string containing a table * @param options - Parse options * @returns Parsed table data with headers, rows, and alignments * * @throws {MarkdownParseError} When no valid table is found in the input * * @example * ```ts * // Basic table * const result = parseMarkdown("| Name | Age |\n| --- | --- |\n| Alice | 30 |"); * * // With alignment * const result = parseMarkdown("| Left | Center | Right |\n|:---|:---:|---:|\n|a|b|c|"); * // result.alignments = ["left", "center", "right"] * * // From a larger Markdown document * const result = parseMarkdown(markdownDoc); // Finds the first table * * // With options * const result = parseMarkdown(input, { trim: false, maxRows: 100 }); * ``` */ export declare function parseMarkdown(input: string, options?: MarkdownParseOptions): MarkdownParseResult; /** * Parse all Markdown tables from a document. * * @param input - Markdown string containing one or more tables * @param options - Parse options (maxRows applies per table) * @returns Array of parsed tables * * @example * ```ts * const tables = parseMarkdownAll(markdownDoc); * console.log(`Found ${tables.length} tables`); * tables.forEach((t, i) => console.log(`Table ${i}: ${t.headers.join(", ")}`)); * ``` */ export declare function parseMarkdownAll(input: string, options?: MarkdownParseOptions): MarkdownParseResult[];