Documentation
¶
Overview ¶
Package renderer assembles individual parts into the final HTML document. It uses html/template for safe HTML rendering, combining theme CSS, cover, TOC, and chapter content.
html_standalone.go renders a self-contained single-page HTML document. The output embeds CSS and JavaScript and implements a GitBook-style three-column layout: left sidebar (global TOC), center content area, right in-page TOC.
Additional features: dark/light/system theme toggle, code copy button with language label, callout boxes, full-text search (⌘K), prev/next navigation, image lightbox, Mermaid diagrams, and KaTeX math formulas.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChapterHTML ¶
type ChapterHTML struct {
Title string // Chapter title
ID string // Chapter unique identifier
Content string // Chapter HTML content
Depth int // Chapter depth in book structure (0-based)
Headings []NavHeading // Heading tree within the chapter, used for navigation
}
ChapterHTML represents the HTML content of a single chapter.
type HTMLRenderer ¶
type HTMLRenderer struct {
// contains filtered or unexported fields
}
HTMLRenderer assembles individual parts into the final HTML document.
func NewHTMLRenderer ¶
func NewHTMLRenderer(cfg *config.BookConfig, thm *theme.Theme) (*HTMLRenderer, error)
NewHTMLRenderer creates a new HTML renderer used for PDF generation.
func (*HTMLRenderer) Render ¶
func (r *HTMLRenderer) Render(parts *RenderParts) (string, error)
Render assembles all parts into a complete HTML document.
type NavHeading ¶
type NavHeading struct {
}
NavHeading represents a navigation heading tree within a chapter.
type RenderParts ¶
type RenderParts struct {
CoverHTML string // Cover page HTML
TOCHTML string // Table of contents HTML
ChaptersHTML []ChapterHTML // All chapters
CustomCSS string // Custom CSS
}
RenderParts contains the individual parts to be rendered.
type StandaloneHTMLRenderer ¶
type StandaloneHTMLRenderer struct {
// contains filtered or unexported fields
}
StandaloneHTMLRenderer renders a self-contained single-page HTML document.
func NewStandaloneHTMLRenderer ¶
func NewStandaloneHTMLRenderer(cfg *config.BookConfig, thm *theme.Theme) (*StandaloneHTMLRenderer, error)
NewStandaloneHTMLRenderer creates a single-page HTML renderer.
func (*StandaloneHTMLRenderer) Render ¶
func (r *StandaloneHTMLRenderer) Render(parts *RenderParts) (string, error)
Render renders the complete single-page HTML document.