Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Block ¶ added in v0.5.0
Block is one top-level chunk of a rendered document: a direct child of ast.Document — a paragraph, a heading, a whole list, a blockquote, a fenced code block (mermaid included), a table or the footnote list. Start and Stop
type IDSpace ¶ added in v0.5.0
type IDSpace struct {
// contains filtered or unexported fields
}
IDSpace assigns anchor ids for a page that may hold several markdown documents at once. It keeps two levels of bookkeeping:
func NewIDSpace ¶ added in v0.5.0
func NewIDSpace() *IDSpace
NewIDSpace returns an empty id space shared by all documents of one page.
func (*IDSpace) DocPrefix ¶ added in v0.5.0
DocPrefix turns a markdown file name into a page-unique document prefix: the base name without extension, slugified ("doc" when nothing survives), with a numeric suffix on collision. The prefix is reserved in the global namespace
type ImageCache ¶ added in v0.5.0
type ImageCache interface {
Load(abs string) (uri string, ok bool)
Store(abs, uri string, mod time.Time)
}
ImageCache memoises the data: URIs produced by inlining local images, keyed by absolute file path. Edit mode re-parses every document of the page after each accepted edit, and without a cache each of those passes would re-read and
type MemImageCache ¶ added in v0.5.0
type MemImageCache struct {
// contains filtered or unexported fields
}
MemImageCache is an in-memory ImageCache safe for concurrent use.
func NewMemImageCache ¶ added in v0.5.0
func NewMemImageCache() *MemImageCache
NewMemImageCache returns an empty cache ready for use.
func (*MemImageCache) Load ¶ added in v0.5.0
func (c *MemImageCache) Load(abs string) (string, bool)
Load returns the memoised URI for abs. It misses when nothing was stored for the path, when the file can no longer be stat'ed (deleted or unreadable — the caller's own read then produces the proper warning) or when its mtime differs
type Options ¶ added in v0.5.0
type Options struct {
Prefix string
IDs *IDSpace
Siblings map[string]string
Images ImageCache
}
Options tunes how a document is rendered as part of a possibly multi-document page. The zero value renders a stand-alone document exactly as a single-file run does.
type Result ¶
type Result struct {
HTML []byte
Blocks []Block
Title string
TOC []TOCEntry
HasMermaid bool
HasKatex bool
Warnings []string
}
Result is the outcome of rendering a markdown document. HTML is a content fragment (not a full document); the page package wraps it into a standalone HTML file.