fsmarkdown

package
v0.84.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Overview

buyer beware

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DetailedPage

type DetailedPage struct {
	*Page
	Sitemap      Sitemap
	IndexSitemap Sitemap
	BackItem     string
}

type FrontmatterParser

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

type Instance

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

Do not initialize manually. Always create with New().

func New

func New(opts Options) *Instance

func (*Instance) GetPageDetails

func (inst *Instance) GetPageDetails(r *http.Request) (detailedPage *DetailedPage, err error)

func (*Instance) GetPlainMarkdown

func (inst *Instance) GetPlainMarkdown(r *http.Request) (string, error)

func (*Instance) PlainTextMiddleware added in v0.83.0

func (md *Instance) PlainTextMiddleware(patterns ...string) func(http.Handler) http.Handler

PlainTextMiddleware serves the plain markdown content of pages when the request's Accept header includes "text/plain" or "text/markdown". Patterns use the default semantics of the kit/matcher package (e.g., "/docs/*" for nested paths, "/docs/:slug" for dynamic segments, or "/docs" for an exact match). To include everything, pass "/*".

type MarkdownParser

type MarkdownParser = func([]byte, io.Writer) error

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"`
	Content     template.HTML
	RawContent  string
	URL         string
	IsFolder    bool
}

type Sitemap

type Sitemap []SitemapItem

type SitemapItem

type SitemapItem struct {
	Title       string `json:"title"`
	URL         string `json:"url"`
	Description string `json:"description,omitempty"`
	Date        string `json:"date,omitempty"`
	IsFolder    bool   `json:"isFolder,omitempty"`
	IsActive    bool   `json:"isActive,omitempty"`
}

Jump to

Keyboard shortcuts

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