Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cell ¶
type Cell struct {
Content string
ColSpan int // For merged cells (DOCX), 1 if not merged
RowSpan int // For merged cells (DOCX), 1 if not merged
}
Cell represents a table cell with optional merged cell information.
type DocumentData ¶
type DocumentData struct {
Elements []Element // Ordered sequence of elements (preserves document structure)
Headings []Heading // All headings (for backward compatibility)
Paragraphs []Paragraph // All paragraphs (for backward compatibility)
Tables []Table // All tables (for backward compatibility)
Images []Image // All images (for backward compatibility)
Lists []List // All lists (for backward compatibility, DOCX only)
Links []Link // All links (for backward compatibility, DOCX only)
Warnings []Warning // Parsing warnings (non-fatal issues)
}
DocumentData represents extracted document content from DOCX or PDF files. This is the common data structure used by both parsers before conversion to Markdown. Elements preserves document order if populated by the parser. The individual slices (Headings, Paragraphs, etc.) are kept for backward compatibility.
type Element ¶
type Element struct {
Type ElementType
Heading *Heading
Paragraph *Paragraph
Table *Table
Image *Image
List *List
Link *Link
}
Element represents a single document element with its type and data. This preserves document order by allowing elements to be stored in sequence.
type ElementType ¶
type ElementType int
ElementType represents the type of a document element.
const ( ElementTypeHeading ElementType = iota ElementTypeParagraph ElementTypeTable ElementTypeImage ElementTypeList ElementTypeLink )
type Formatting ¶
Formatting represents text formatting attributes.
type Image ¶
type Image struct {
Data []byte
Format string // "png", "jpeg", "gif", etc.
Filename string
AltText string
Width int
Height int
}
Image represents an extracted image from the document.
type Paragraph ¶
type Paragraph struct {
Text string
Formatting Formatting
}
Paragraph represents a paragraph with optional formatting.
type Warning ¶
type Warning struct {
Category string // Category of warning: "image", "table", "link", "close", etc.
Message string // Human-readable warning message
Error error // Optional underlying error (nil if no error)
}
Warning represents a non-fatal parsing issue that occurred during document extraction. Warnings allow users to know about partial failures (e.g., failed image extraction, table extraction issues) without failing the entire parse operation.