import type { Token, Tokens } from 'marked'; /** * Configuration options for the extended tables extension */ export interface SpanTableOptions { /** * Whether to render the table with thead and tbody tags * @default true */ useTheadTbody?: boolean; /** * Whether to use tfoot for the last row * @default false */ useTfoot?: boolean; /** * Custom class to add to the table element */ className?: string | null; /** * Whether to place caption at the top of the table * @default true */ captionTop?: boolean; /** * Whether to detect and mark the last row as a footer * @default false */ detectFooter?: boolean; /** * Whether to enforce strict caption syntax * @default false */ strictCaptions?: boolean; /** * Maximum number of columns a cell can span (null for no limit) * @default null */ maxColspan?: number | null; /** * Enable enhanced handling of complex row+column spanning * @default true */ handleComplexSpans?: boolean; } /** * A cell in the table */ export interface TableCell { /** * Number of rows this cell spans vertically */ rowspan: number; /** * Number of columns this cell spans horizontally */ colspan: number; /** * The text content of the cell */ text: string; /** * Original column position */ position: number; /** * Parsed inline tokens from the cell text */ tokens?: Token[]; /** * Reference to the original cell when using rowspan */ rowSpanTarget?: TableCell; /** * Flag indicating complex row+column spanning */ complexRowSpan?: boolean; /** * Reference to related cell in complex spanning scenarios */ relatedCell?: TableCell; } /** * A row in the table, consisting of multiple cells */ export type TableRow = TableCell[]; /** * Internal token structure during tokenization */ export interface SpanTableTokenInternal { /** * Type identifier for the token */ type: 'spanTable'; /** * Header rows of the table (strings during parsing, TableRow[] after processing) */ header: (string | TableRow)[]; /** * Alignment for each column ('left', 'center', 'right', or null) */ align: (string | null)[]; /** * Data rows of the table (strings during parsing, TableRow[] after processing) */ rows: (string | TableRow)[]; /** * Footer row if detectFooter is enabled */ footerRow?: TableRow; /** * Whether the table has a footer row */ hasFooter?: boolean; /** * Caption text if available */ caption?: string; /** * Parsed tokens for the caption */ captionTokens?: Token[]; /** * Original markdown source of the table */ raw: string; } /** * Token representing a table with spans */ export interface SpanTableToken extends Tokens.Generic { /** * Type identifier for the token */ type: 'spanTable'; /** * Header rows of the table */ header: TableRow[]; /** * Alignment for each column ('left', 'center', 'right', or null) */ align: (string | null)[]; /** * Data rows of the table */ rows: TableRow[]; /** * Footer row if detectFooter is enabled */ footerRow?: TableRow; /** * Whether the table has a footer row */ hasFooter?: boolean; /** * Caption text if available */ caption?: string; /** * Parsed tokens for the caption */ captionTokens?: Token[]; /** * Original markdown source of the table */ raw: string; } /** * Lexer interface for tokenization */ export interface Lexer { inline(src: string, tokens: Token[]): Token[]; } /** * Parser interface for rendering */ export interface Parser { parseInline(tokens: Token[]): string; }