Documentation
¶
Overview ¶
Package document implements Markdown document processing and serving.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultMarkdown is the default converter for Markdown to HTML. DefaultMarkdown = goldmark.New( goldmark.WithExtensions(extension.GFM), goldmark.WithParserOptions(parser.WithAutoHeadingID()), ) )
Functions ¶
This section is empty.
Types ¶
type Document ¶
type Document struct {
// contains filtered or unexported fields
}
Document is a HTML representation of Markdown text.
func NewDocument ¶ added in v0.4.0
NewDocument creates a new document with the given name and Markdown converter.
func (*Document) Borrow ¶
Borrow temporarily borrows the document's HTML for the lifetime of fn. buf must not be mutated or used outside of fn.
type Library ¶
type Library struct {
// contains filtered or unexported fields
}
Library is a collection of Markdown documents.
func NewLibrary ¶
NewLibrary creates a new library using the given source and Markdown converter. If md is nil, DefaultMarkdown is used.
func (*Library) Create ¶ added in v0.4.0
Create reads a document from the library's source. If the document exists, the existing document's content is reloaded.
func (*Library) Open ¶ added in v0.4.0
Open reads the document with name. If the document does not exist, ok is false.
type Server ¶ added in v0.4.0
type Server struct {
// contains filtered or unexported fields
}
Server serves documents and their accompanying CSS/JS assets over HTTP.
type Template ¶ added in v0.4.0
type Template struct {
// The HTML title to use.
Title string
// The directory where assets are served.
// index.js and index.css must be present in the directory.
AssetURL string
// The path where SSE events are served.
EventURL string
// The initial content of the HTML page.
Content template.HTML
}
Template is the HTML template for serving a document. For the template itself, see template.html.