package parser import "golang.org/x/net/html" // ContentType represents the type of editable content type ContentType string const ( ContentText ContentType = "text" ContentMarkdown ContentType = "markdown" ContentLink ContentType = "link" ) // Element represents a parsed editable element type Element struct { FilePath string `json:"file_path"` Node *html.Node `json:"-"` // Don't serialize HTML node ContentID string `json:"content_id"` Type ContentType `json:"type"` Tag string `json:"tag"` Classes []string `json:"classes"` Content string `json:"content"` HasID bool `json:"has_id"` // Whether element had existing ID Generated bool `json:"generated"` // Whether ID was generated } // ParseResult contains the results of parsing HTML files type ParseResult struct { Elements []Element `json:"elements"` Warnings []string `json:"warnings"` Stats ParseStats `json:"stats"` } // ParseStats provides statistics about the parsing operation type ParseStats struct { FilesProcessed int `json:"files_processed"` TotalElements int `json:"total_elements"` ExistingIDs int `json:"existing_ids"` GeneratedIDs int `json:"generated_ids"` TypeBreakdown map[ContentType]int `json:"type_breakdown"` }