Documentation ¶
Overview ¶
Package omh implements converter tooling from Obsidian to Hugo
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrNoFrontMatter = errors.New("missing front matter")
)
Define errors for front matter parsing
var TimeZone = time.UTC
Functions ¶
Types ¶
type ConvertName ¶
ConvertName makes a name link-suitable
type Converter ¶
type Converter struct { ConvertName // ObsidianRoot is the root of the Obsidian Vault (or a sub-directory thereof) ObsidianRoot ObsidianDirectory // HugoRoot is the root of the Hugo setup, which contains `content` and `static` folders HugoRoot string // SubPath defaults to `obsidian` and is the sub-path that will be used under `content` and `static` SubPath string // FrontMatter is additional front-matter added to each document FrontMatter map[string]interface{} // TagsKey is name of the key in front-matter that should contain tags (or unset, in case not changed) TagsKey string // contains filtered or unexported fields }
Converter transforms all notes from Obsidian (Vault) directory into pages in Hugo, with rewritten internal links
type FrontMatter ¶
type FrontMatter map[string]interface{}
FrontMatter is meta information for markdown documents
func ParseFrontMatterMarkdown ¶
func ParseFrontMatterMarkdown(content []byte) (FrontMatter, string, error)
Parses a Markdown file into front matter and body content
func (FrontMatter) Has ¶
func (fm FrontMatter) Has(key string) bool
Checks if a specific key exists in the front matter
func (FrontMatter) String ¶
func (fm FrontMatter) String(key string) string
Retrieves the value for a key as a string
func (FrontMatter) Strings ¶
func (fm FrontMatter) Strings(key string) []string
Retrieves the value for a key as a slice of strings
type ObsidianDirectory ¶
type ObsidianDirectory struct { Name string Path string Parent *ObsidianDirectory Childs []ObsidianDirectory Notes []ObsidianNote Files []string }
ObsidianDirectory is a directory within an Obsidian Vault
func LoadObsidianDirectory ¶
func LoadObsidianDirectory(path string, filter ObsidianFilter, recurse bool) (root ObsidianDirectory, err error)
LoadObsidianDirectory reads all notes and sub-directories within a directory in an Obsidian vault
func (ObsidianDirectory) Empty ¶
func (directory ObsidianDirectory) Empty() bool
func (ObsidianDirectory) LinkMap ¶
func (directory ObsidianDirectory) LinkMap(convert ConvertName) map[string]string
LinkMap is the map of Obsidian internal links to Hugo compatible web links ({"Internal Name": "directory/internal-name"}). Note that the Obsidian structure is flat!
type ObsidianFilter ¶
type ObsidianFilter func(ObsidianNote) bool
ObsidianFilter includes or excludes a note
type ObsidianNote ¶
type ObsidianNote struct { FrontMatter Title string Content string Directory *ObsidianDirectory }
ObsidianNote is a single note in Obsidian
func LoadObsidianNote ¶
func LoadObsidianNote(path string) (ObsidianNote, error)
LoadObsidianNote loads an Obsidian note from disk at given path
func (ObsidianNote) HugoFrontMatter ¶
func (note ObsidianNote) HugoFrontMatter(added map[string]interface{}) map[string]interface{}
HugoFrontMatter returns an updated front-matter metadata, suitable for Hugo pages