Documentation
¶
Index ¶
Constants ¶
const ( HElemText = 0 HElemH1 = 1 HElemH2 = 2 HElemLink = 3 HElemImage = 4 HElemBlockquote = 5 HElemTable = 6 )
HTMLElementType constants mirror the C enum values in htmlconv.h.
Variables ¶
This section is empty.
Functions ¶
func ImageDimensions ¶
ImageDimensions returns the width and height of an image without fully decoding pixel data. This is the pure Go fallback — it must fully decode the image since Go's stdlib does not support header-only reads.
func MarkdownToHTML ¶ added in v0.27.8
MarkdownToHTML converts Markdown bytes to HTML using md4c (C). This is significantly faster than goldmark for large documents.
func WrapBase64 ¶
WrapBase64 wraps base64-encoded data at 76 characters per line with \r\n separators, as required by MIME (RFC 2045).
Types ¶
type HTMLElement ¶ added in v0.27.8
type HTMLElement struct {
Type int
Text string // Text content
Attr1 string // href (link), src (image), cite (blockquote)
Attr2 string // alt (image), prev_text (blockquote)
}
HTMLElement represents a parsed element from an HTML document.
func HTMLToElements ¶ added in v0.27.8
func HTMLToElements(html string) ([]HTMLElement, bool)
HTMLToElements parses HTML and returns structured elements. This is a single-pass C parser that replaces goquery-based DOM parsing.
type ImageConvertResult ¶
ImageConvertResult holds the output of DecodeToPNG.
func DecodeToPNG ¶
func DecodeToPNG(data []byte) (ImageConvertResult, bool)
DecodeToPNG takes raw image bytes (JPEG, PNG, BMP, GIF, etc.) and returns PNG-encoded bytes along with image dimensions. This is the pure Go fallback used when cgo is not available.