fsmarkdown

package
v0.85.0-pre.13 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FrontmatterParser

type FrontmatterParser = func(io.Reader, any) ([]byte, error)

type Instance

type Instance struct {
	Options
	// contains filtered or unexported fields
}

func New

func New(opts Options) *Instance

New creates an Instance. Panics if FS, FrontmatterParser, or MarkdownParser are nil.

func (*Instance) Lookup

func (inst *Instance) Lookup(_path string) (*Result, bool, error)

Lookup resolves a clean URL path (e.g. "/docs/intro") to a Result. Returns (result, false, nil) if the path does not exist.

func (*Instance) PlainMarkdown

func (inst *Instance) PlainMarkdown(path string) (string, error)

PlainMarkdown returns the raw markdown with a title heading prepended.

func (*Instance) PlainTextMiddleware added in v0.83.0

func (inst *Instance) PlainTextMiddleware(
	patterns ...string,
) func(http.Handler) http.Handler

PlainTextMiddleware serves plain markdown when the Accept header includes "text/plain" or "text/markdown" and the path matches one of the given patterns (kit/matcher semantics).

type MarkdownParser

type MarkdownParser = func([]byte, io.Writer) error
type NavItem struct {
	Title       string
	URL         string
	Description string
	Date        string
	IsFolder    bool
	IsActive    bool
}

type Options

type Options struct {
	FS                fs.FS
	IsDev             bool
	FrontmatterParser FrontmatterParser
	MarkdownParser    MarkdownParser
}

type Page

type Page struct {
	Title       string `yaml:"title"`
	Description string `yaml:"description"`
	Date        string `yaml:"date"`
	Order       int    `yaml:"order"`
	HTML        string
	Raw         string
	URL         string
	IsFolder    bool
}

type Result

type Result struct {
	Page      *Page
	Siblings  []NavItem
	Children  []NavItem
	ParentURL string
}

Jump to

Keyboard shortcuts

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