Documentation ¶
Overview ¶
Package mdoc provides a http.Handler that renders a directory of Markdown documents.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("mdoc: file not found")
ErrNotFound represents that the file does not exist or is not a Markdown file.
Functions ¶
Types ¶
type DocumentPage ¶
DocumentPage represents the data used to render a document.
type File ¶
File represents a file for use in a HTML view.
func (File) DisplayName ¶
DisplayName returns the file name with a forward slash appended for directories.
type Layout ¶
type Layout struct {
// contains filtered or unexported fields
}
Layout represents the page data used by both IndexPage and DocumentPage.
func (Layout) StaticFile ¶
StaticFile returns the path to an asset file.
type Option ¶
type Option func(*handler)
Option describes a functional option for configuring the handler.
func DocumentRenderer ¶
func DocumentRenderer(fn func(v DocumentPage) ([]byte, error)) Option
DocumentRenderer sets the DocumentPage rendering function. Defaults to a basic rendering function.
func ErrorHandler ¶
ErrorHandler sets the http.Handler to delegate to when errors are returned. Defaults to writing plain text error messages.
func IndexRenderer ¶
IndexRenderer sets the IndexPage rendering function. Defaults to a basic rendering function.