internal

package
v0.13.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2026 License: MIT Imports: 45 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildExportHTML added in v0.11.0

func BuildExportHTML(content template.HTML, includeJS bool, rootDir string) (string, error)

BuildExportHTML renders a standalone HTML page from rendered Markdown content. When includeJS is true, <script> tags for Mermaid and MathJax are included (for use when the file will be opened while the server is running). When includeJS is false, no JS is emitted (for CLI export or fully static output). rootDir is the base directory for resolving local image paths. Pass "" to skip image embedding.

func ExportFilename added in v0.11.0

func ExportFilename(mdPath string) string

ExportFilename derives the output filename from a Markdown file path. README.md -> README.html, path/to/doc.md -> doc.html

func Open

func Open(url string) error

Types

type Article

type Article struct {
	Title       string
	Path        string
	Filename    string
	Active      bool
	IsDirectory bool
	Expanded    bool
	Children    []Article
}

type ExportData added in v0.11.0

type ExportData struct {
	Content      template.HTML
	CssLight     template.CSS // github-markdown-light.css
	CssCodeLight template.CSS // Chroma light syntax highlighting
	CssMermaid   template.CSS // github-mermaid.css
	CssMathJax   template.CSS // mathjax.css
	CssClipboard template.CSS // github-clipboard.css
	IncludeJS    bool         // include <script> tags for Mermaid/MathJax
}

ExportData carries the data used by the export template (templates/export.html).

type PDFData added in v0.11.0

type PDFData struct {
	Content      template.HTML
	CssLight     template.CSS // github-markdown-light.css
	CssPrint     template.CSS // stripped github-print.css
	CssCodeLight template.CSS // Chroma light syntax highlighting
	CssMermaid   template.CSS // github-mermaid.css
	CssMathJax   template.CSS // mathjax.css
}

PDFData carries the data used by the print template (templates/print.html).

type PDFGenerator added in v0.11.0

type PDFGenerator struct {
	// contains filtered or unexported fields
}

PDFGenerator manages a headless Chrome browser pool for PDF generation.

func NewPDFGenerator added in v0.11.0

func NewPDFGenerator(maxConcurrent int) (*PDFGenerator, error)

NewPDFGenerator creates a new PDFGenerator with a headless Chrome allocator. maxConcurrent controls how many PDFs can be generated in parallel (1-4).

func (*PDFGenerator) Close added in v0.11.0

func (g *PDFGenerator) Close()

Close shuts down the Chrome browser allocator and releases resources.

func (*PDFGenerator) GeneratePDF added in v0.11.0

func (g *PDFGenerator) GeneratePDF(htmlContent string) ([]byte, error)

GeneratePDF renders an HTML string to PDF using headless Chrome. It returns the PDF bytes ready to serve.

type Parser

type Parser struct{}

func NewParser

func NewParser() *Parser

func (Parser) MdToHTML

func (m Parser) MdToHTML(input []byte) ([]byte, error)

func (Parser) Render

func (m Parser) Render(input []byte) (*RenderedDocument, error)

type RenderedDocument

type RenderedDocument struct {
	Content string
	TOC     []TOCEntry
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(host string, port int, boundingBox bool, browser bool, enableReload bool, parser *Parser) *Server

func NewServerWithOptions

func NewServerWithOptions(opts ServerOptions) *Server

func (*Server) Serve

func (s *Server) Serve(file string) error

type ServerOptions

type ServerOptions struct {
	Host         string
	Port         int
	BoundingBox  bool
	Browser      bool
	EnableReload bool
	StrictPort   bool
	Recursive    bool
	Parser       *Parser
}

type TOCEntry

type TOCEntry struct {
	Level int
	Text  string
	ID    string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL