frontmatter

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package frontmatter transforms journal YAML frontmatter into Obsidian-compatible format.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractStringSlice

func ExtractStringSlice(m map[string]any, key string) []string

ExtractStringSlice extracts a []string from a map value that may be []any (as returned by yaml.Unmarshal into map[string]any).

Parameters:

  • m: Source map
  • key: Key to extract

Returns:

  • []string: Extracted strings, or nil if key is missing/empty

func TransformFrontmatter

func TransformFrontmatter(content, sourcePath string) string

TransformFrontmatter converts journal frontmatter to Obsidian format.

Changes applied:

  • topics -> tags (Obsidian-recognized key)
  • aliases added from title (makes entries findable by name)
  • source_file added with the relative path to the source entry
  • technologies preserved as custom property

Parameters:

  • content: Full Markdown content with YAML frontmatter
  • sourcePath: Relative path to the source journal file

Returns:

  • string: Content with transformed frontmatter

Types

type ObsidianFrontmatter

type ObsidianFrontmatter struct {
	Title        string   `yaml:"title"`
	Date         string   `yaml:"date"`
	Type         string   `yaml:"type,omitempty"`
	Outcome      string   `yaml:"outcome,omitempty"`
	Tags         []string `yaml:"tags,omitempty"`
	Technologies []string `yaml:"technologies,omitempty"`
	KeyFiles     []string `yaml:"key_files,omitempty"`
	Aliases      []string `yaml:"aliases,omitempty"`
	SourceFile   string   `yaml:"source_file,omitempty"`
}

ObsidianFrontmatter represents the YAML frontmatter for Obsidian vault entries. Extends JournalFrontmatter with Obsidian-specific fields.

Jump to

Keyboard shortcuts

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