library

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package library finds the markdown files a start screen lists: the TUI's and mdsh-gui's.

Index

Constants

View Source
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

View Source
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.

func List

func List(root string) (Listing, error)

List finds the .md and .markdown files under root, in path order, and the collections among its folders. It leaves out hidden folders, node_modules, vendor and mdsh's .assets folders, goes at most MaxDepth folders down and stops at MaxFiles.

Jump to

Keyboard shortcuts

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