bundle

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 29, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package bundle packages a document and its dependencies into a portable .mdoc zip archive. The bundle is a regular zip with a custom extension — same pattern as .docx / .epub / .pptx — so any unzip tool can crack it open and the file manager can preview the contents.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveOutputPath added in v0.1.1

func ResolveOutputPath(doc *document.Document, outputPath string) (string, error)

ResolveOutputPath returns the absolute path Export will write to: the explicit outputPath when given, otherwise <source-basename>.mdoc next to the document. Exposed so callers can check for an existing file before committing to a bundle.

Types

type Options

type Options struct {
	// OutputPath is the .mdoc file to write. Empty means write next to
	// the source document as <basename>.mdoc.
	OutputPath string
}

Options configures Export.

type Result

type Result struct {
	OutputPath string
	// Entries lists the bundle-relative paths included, in insertion order.
	Entries []string
}

Result describes what Export produced.

func Export

func Export(doc *document.Document, thm *theme.Theme, opts Options) (*Result, error)

Export packs the document, its resolved theme, and the conventional assets/ sibling directory (if present) into a .mdoc zip. The bundle is laid out so that unzipping it yields a directory mdoc can open directly:

example.mdoc
├── document.md
├── themes/<name>.html
└── assets/...

Jump to

Keyboard shortcuts

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