Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Version = "dev"
Version is set at build time via ldflags.
Functions ¶
func Render ¶
Render converts markdown input to a PNG file at the given output path. It requires Ghostscript (gs) to be installed on the system. Uses DefaultConfig(). For custom options, use RenderWithConfig.
func RenderWithConfig ¶ added in v1.1.0
RenderWithConfig converts markdown input to a PNG or PDF file using the given configuration. If cfg.AsPDF is true, output is a PDF file directly (Ghostscript is not needed). Otherwise, Ghostscript converts the PDF to PNG.
Types ¶
type Color ¶ added in v1.1.0
type Color struct {
R, G, B int
}
Color represents an RGB color with values 0–255.
func HexToColor ¶ added in v1.1.0
HexToColor parses a hex color string like "#333366" or "333366" into a Color.
type Config ¶ added in v1.1.0
type Config struct {
// Font
FontFamily string // "Helvetica", "Times", or "Courier"
FontSize float64 // Body text size in points
// Page
PageWidth float64 // Page width in mm (default: 210 = A4)
PageHeight float64 // Page height in mm (default: 297 = A4)
MarginTop float64 // Top margin in mm
MarginLeft float64 // Left margin in mm
MarginRight float64 // Right margin in mm
MarginBottom float64 // Bottom margin in mm (used for page break check)
// Text colors
TextColor Color // Default body text color
// Heading colors and sizes
HeadingColor Color // Heading text color
HeadingSizes [6]float64 // Font sizes for H1–H6
HeadingFont string // Heading font family override ("", same as FontFamily)
// Table
TableHeaderBg Color // Table header background
TableHeaderFg Color // Table header text color
TableHeaderFont string // Table header font family ("", same as FontFamily)
TableHeaderSize float64 // Table header font size
TableCellHeight float64 // Row height in mm
TableRowEven Color // Even row background
TableRowOdd Color // Odd row background
// Code block
CodeBg Color // Code block background
CodeFont string // Code font family (default: "Courier")
CodeFontSize float64 // Code font size
CodeLineHeight float64 // Code line height in mm
// Blockquote
BlockquoteLineColor Color // Left border color
BlockquoteTextColor Color // Quote text color
BlockquoteFont string // Quote font (default: same as FontFamily, italic)
// Horizontal rule
HRColor Color // HR line color
HRLineWidth float64 // HR line thickness in mm
// Output
DPI int // Ghostscript DPI (default: 200)
AsPDF bool // Output PDF instead of PNG
}
Config holds all customizable rendering options.
func DefaultConfig ¶ added in v1.1.0
func DefaultConfig() Config
DefaultConfig returns a Config with sensible defaults.