Documentation
¶
Overview ¶
Package source contains various file sources for Markdown documents.
Index ¶
Constants ¶
View Source
const ( // Root represents the root document path in a source. // Certain sources only serve a single Markdown file and may check for this value to serve that file. Root = "." )
Variables ¶
View Source
var ( // ErrSourceNotFound means that a source for the URL scheme was not found. ErrSourceNotFound = errors.New("source schema not found") )
Functions ¶
func Must ¶ added in v0.4.0
Must unwraps a (value, error) return to just the value. If err is not nil, this panics.
Types ¶
type Directory ¶
type Directory struct {
// contains filtered or unexported fields
}
Directory is a source that serves a directory on the filesystem.
type File ¶
type File struct {
// contains filtered or unexported fields
}
File is a source that serves a single file on the filesystem.
type Source ¶
Source is a filesystem serving Markdown files.
func New ¶
New creates a source from the URL. If the source for the URL scheme does not exist, ErrSourceNotFound is returned.
func NewDirectory ¶
NewDirectory creates a new directory source.
type Watcher ¶ added in v0.4.0
type Watcher interface {
Source
// Watch starts watching the source for Markdown file changes,
// sending them over the files channel.
// Any error encountered should be sent over the errors channel.
//
// When the watcher is closed, both returned channels should be closed.
Watch() (files <-chan string, errors <-chan error)
// Close closes the watcher.
Close() error
}
Watcher is a source that supports file watching.
Click to show internal directories.
Click to hide internal directories.