Documentation
¶
Overview ¶
Package library finds the markdown files a start screen lists: the TUI's and mdsh-gui's.
Index ¶
Constants ¶
const ( MaxDepth = 6 // folders below root MaxFiles = 500 // files listed MaxSize = 1 << 20 // bytes read to count blocks MaxDesc = 300 // runes of a description kept )
Limits keep a listing of a big folder, such as home, quick.
Variables ¶
var DescriptionKeys = []string{"description", "summary", "abstract"}
DescriptionKeys are the front matter keys read for a description, first match wins. description is what Jekyll, Hugo, Docusaurus, MkDocs, Obsidian Publish, Astro and Quarto use; summary is Hugo's; abstract is Pandoc's and Quarto's.
Functions ¶
This section is empty.
Types ¶
type Collection ¶
type Collection struct {
// Rel is the folder relative to the listed folder, with forward
// slashes; "" is the listed folder itself.
Rel string `json:"rel"`
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Icon string `json:"icon,omitempty"`
Color string `json:"color,omitempty"`
Tags []string `json:"tags,omitempty"`
// IconPath and Background are absolute paths of images inside the
// folder; IconURL and BackgroundURL are where the window loads
// them, filled in by whoever serves them.
IconPath string `json:"-"`
Background string `json:"-"`
IconURL string `json:"iconURL,omitempty"`
BackgroundURL string `json:"backgroundURL,omitempty"`
// Problems are the parts of .mdsh.yaml that were ignored, and why.
Problems []string `json:"problems,omitempty"`
// Error, if set, says why .mdsh.yaml was ignored as a whole; the
// folder shows as a plain folder.
Error string `json:"error,omitempty"`
}
Collection is a listed folder with a .mdsh.yaml file. See package collection.
type File ¶
type File struct {
// Path is the file's absolute path.
Path string `json:"path"`
// Rel is Path relative to the listed folder, with forward slashes.
Rel string `json:"rel"`
// Blocks is how many blocks mdsh would run, or -1 if the file
// doesn't parse.
Blocks int `json:"blocks"`
// Description is the file's front matter description, if it has
// one. See DescriptionKeys.
Description string `json:"description,omitempty"`
// Tags are the file's front matter tags plus those of the
// collections it is in, from the listed folder down. See
// collection.Tags.
Tags []string `json:"tags,omitempty"`
// Mod is when the file last changed.
Mod time.Time `json:"mod"`
}
File is a markdown file under the listed folder.
type Listing ¶
type Listing struct {
// Files are in path order.
Files []File
// Collections are the folders with a .mdsh.yaml, in path order.
Collections []Collection
// Full is true when List stopped at MaxFiles.
Full bool
}
Listing is what List finds.