moc

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: 14 Imported by: 0

Documentation

Overview

Package moc generates Obsidian Maps of Content for journal vault navigation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildTopicLookup

func BuildTopicLookup(entries []entity.JournalEntry) map[string][]entity.JournalEntry

BuildTopicLookup creates a map from the topic name to all entries with that topic, for efficient related-entry lookups.

Parameters:

  • entries: Entries with topics

Returns:

  • map[string][]JournalEntry: Topic name -> entries

func CollectRelated

func CollectRelated(
	entry entity.JournalEntry,
	topicIndex map[string][]entity.JournalEntry,
	maxRelated int,
) []entity.JournalEntry

CollectRelated finds entries that share topics with the given entry, excluding the entry itself. Returns up to maxRelated unique entries, prioritized by number of shared topics.

Parameters:

  • entry: The current journal entry
  • topicIndex: Map of topic name -> entries
  • maxRelated: Maximum results

Returns:

  • []JournalEntry: Related entries, deduplicated

func FilterEntriesWithKeyFiles

func FilterEntriesWithKeyFiles(entries []entity.JournalEntry) []entity.JournalEntry

FilterEntriesWithKeyFiles returns non-suggestive, non-multipart entries that have key files.

Parameters:

  • entries: All journal entries

Returns:

  • []JournalEntry: Entries with key files

func FilterEntriesWithTopics

func FilterEntriesWithTopics(entries []entity.JournalEntry) []entity.JournalEntry

FilterEntriesWithTopics returns non-suggestive, non-multipart entries that have topics.

Parameters:

  • entries: All journal entries

Returns:

  • []JournalEntry: Entries with topics

func FilterEntriesWithType

func FilterEntriesWithType(entries []entity.JournalEntry) []entity.JournalEntry

FilterEntriesWithType returns non-suggestive, non-multipart entries that have a type.

Parameters:

  • entries: All journal entries

Returns:

  • []JournalEntry: Entries with type

func FilterRegularEntries

func FilterRegularEntries(entries []entity.JournalEntry) []entity.JournalEntry

FilterRegularEntries returns entries excluding suggestions and multipart continuations.

Parameters:

  • entries: All journal entries

Returns:

  • []JournalEntry: Filtered entries

func GenerateHomeMOC

func GenerateHomeMOC(
	entries []entity.JournalEntry,
	hasTopics, hasFiles, hasTypes bool,
) string

GenerateHomeMOC creates the root navigation hub for the Obsidian vault.

The Home MOC links to all section MOCs and lists recent sessions.

Parameters:

  • entries: All journal entries (filtered, no suggestions/multipart)
  • hasTopics: Whether any topic data exists
  • hasFiles: Whether any key file data exists
  • hasTypes: Whether any type data exists

Returns:

  • string: Markdown content for Home.md

func GenerateObsidianFilePage

func GenerateObsidianFilePage(kf entity.KeyFileData) string

GenerateObsidianFilePage creates an individual key file page with wikilinks grouped by month.

Parameters:

  • kf: Key file data including path and entries

Returns:

  • string: Markdown content for the key file page

func GenerateObsidianFilesMOC

func GenerateObsidianFilesMOC(keyFiles []entity.KeyFileData) string

GenerateObsidianFilesMOC creates the key files index page with wikilinks.

Parameters:

  • keyFiles: Sorted key file data from BuildKeyFileIndex

Returns:

  • string: Markdown content for _Key Files.md

func GenerateObsidianGroupedPage

func GenerateObsidianGroupedPage(
	heading, stats string, entries []entity.JournalEntry,
) string

GenerateObsidianGroupedPage builds a detail page with a heading, stats line, and month-grouped session wikilinks.

Parameters:

  • heading: Pre-formatted Markdown heading
  • stats: Pre-formatted stats line
  • entries: Journal entries to group by month

Returns:

  • string: Complete Markdown page content

func GenerateObsidianTopicPage

func GenerateObsidianTopicPage(topic entity.TopicData) string

GenerateObsidianTopicPage creates an individual topic page with wikilinks grouped by month.

Parameters:

  • topic: Topic data including name and entries

Returns:

  • string: Markdown content for the topic page

func GenerateObsidianTopicsMOC

func GenerateObsidianTopicsMOC(topics []entity.TopicData) string

GenerateObsidianTopicsMOC creates the topics index page with wikilinks.

Popular topics link to dedicated pages; long-tail topics link inline to the first matching session.

Parameters:

  • topics: Sorted topic data from BuildTopicIndex

Returns:

  • string: Markdown content for _Topics.md

func GenerateObsidianTypePage

func GenerateObsidianTypePage(st entity.TypeData) string

GenerateObsidianTypePage creates an individual session type page with wikilinks grouped by month.

Parameters:

  • st: Type data including name and entries

Returns:

  • string: Markdown content for the session type page

func GenerateObsidianTypesMOC

func GenerateObsidianTypesMOC(sessionTypes []entity.TypeData) string

GenerateObsidianTypesMOC creates the session types index page with wikilinks.

Parameters:

  • sessionTypes: Sorted type data from BuildTypeIndex

Returns:

  • string: Markdown content for _Session Types.md

func GenerateRelatedFooter

func GenerateRelatedFooter(
	entry entity.JournalEntry,
	topicIndex map[string][]entity.JournalEntry,
	maxRelated int,
) string

GenerateRelatedFooter builds the "Related Sessions" footer appended to each journal entry in the vault. Links to topic/type MOCs and lists other entries that share topics.

Parameters:

  • entry: The current journal entry
  • topicIndex: Map of topic name -> entries sharing that topic
  • maxRelated: Maximum number of "see also" entries to show

Returns:

  • string: Markdown footer section (empty if entry has no metadata)

func SplitPopular

func SplitPopular[T entity.PopularSplittable](items []T) (popular, longtail []T)

SplitPopular partitions a slice into popular and long-tail groups.

Parameters:

  • items: Slice of items implementing PopularSplittable

Returns:

  • popular: Items where IsPopular() is true
  • longtail: Items where IsPopular() is false

Types

This section is empty.

Jump to

Keyboard shortcuts

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