exporter

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

Package exporter generates static HTML sites from markdown content trees.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContentType

func ContentType(format Format) string

ContentType returns the MIME type for the given format.

func FileExtension

func FileExtension(format Format) string

FileExtension returns the file extension for the given format.

func IsValidFormat

func IsValidFormat(format string) bool

IsValidFormat checks if the given format is valid.

Types

type ExportPageOptions

type ExportPageOptions struct {
	Writer  io.Writer
	Format  Format
	RootDir string
	Path    string
}

ExportPageOptions configures a single page export.

type Exporter

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

Exporter renders markdown content into a static HTML bundle.

func New

func New(logger *slog.Logger) (*Exporter, error)

New constructs an exporter instance ready for use.

func (*Exporter) Export

func (e *Exporter) Export(ctx context.Context, opts Options) error

Export walks the markdown tree rooted at opts.Root and writes a static site to opts.OutputDir.

func (*Exporter) ExportPage

func (e *Exporter) ExportPage(ctx context.Context, opts ExportPageOptions) error

ExportPage exports a single page in the specified format.

type Format

type Format string

Format represents an export format.

const (
	// FormatHTML exports as HTML.
	FormatHTML Format = "html"
	// FormatMarkdown exports as markdown.
	FormatMarkdown Format = "markdown"
	// FormatPlainText exports as plain text.
	FormatPlainText Format = "txt"
	// FormatPDF exports as PDF.
	FormatPDF Format = "pdf"
)

func ValidFormats

func ValidFormats() []Format

ValidFormats returns the list of supported export formats.

type Options

type Options struct {
	Root                string
	OutputDir           string
	AssetsDir           string
	SiteTitle           string
	AssetPrefix         string
	BaseURL             string
	IncludeHidden       bool
	DarkModeFirst       bool
	GenerateSearchIndex bool
	CleanOutput         bool
}

Options configure the static export behavior.

Jump to

Keyboard shortcuts

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