Documentation
¶
Overview ¶
Package model is a placeholder for Obsite domain models.
Index ¶
- func BuildCanonicalLookupNames(values []string) (map[string]string, map[string][]string)
- func BuildCanonicalLookupPaths(values []string) (map[string]string, map[string][]string)
- func BuildExactLookupPaths(values []string) map[string]string
- func CanonicalResourceLookupName(value string) string
- func CanonicalResourceLookupPath(value string) string
- func LessRecentNote(left *Note, right *Note) bool
- func NormalizeTagName(value string) string
- type Asset
- type BacklinkEntry
- type Breadcrumb
- type EmbedRef
- type Frontmatter
- type Heading
- type ImageRef
- type LinkGraph
- type LinkRef
- type Note
- type NoteSummary
- type OpenGraph
- type PageData
- type PageKind
- type PageLink
- type PaginationConfig
- type PaginationData
- type PathLookupResult
- type PopoverConfig
- type RSSConfig
- type RelatedArticle
- type RelatedConfig
- type SearchConfig
- type SectionRange
- type SidebarConfig
- type SidebarNode
- type SiteConfig
- type TOCEntry
- type Tag
- type TagLink
- type ThemeConfig
- type TimelineConfig
- type UnpublishedLookup
- type VaultIndex
- func (idx *VaultIndex) HasResource(relPath string) bool
- func (idx *VaultIndex) HasResourceBaseName(name string) bool
- func (idx *VaultIndex) LookupAssetPath(relPath string) PathLookupResult
- func (idx *VaultIndex) LookupResourceBaseName(name string) PathLookupResult
- func (idx *VaultIndex) LookupResourcePath(relPath string) PathLookupResult
- func (idx *VaultIndex) ResolveAssetPath(relPath string) string
- func (idx *VaultIndex) ResolveResourceBaseName(name string) string
- func (idx *VaultIndex) ResolveResourcePath(relPath string) string
- func (idx *VaultIndex) SetAssets(assets map[string]*Asset)
- func (idx *VaultIndex) SetResources(resourceFiles []string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildCanonicalLookupNames ¶
BuildCanonicalLookupNames returns the basename-only canonical fallback table plus any canonical collisions that must refuse fallback.
func BuildCanonicalLookupPaths ¶
BuildCanonicalLookupPaths returns the canonical-path fallback table plus any canonical collisions that must refuse fallback.
func BuildExactLookupPaths ¶
BuildExactLookupPaths returns the normalized exact-path lookup table for the provided vault-relative paths.
func CanonicalResourceLookupName ¶
CanonicalResourceLookupName returns the shared canonical form used for basename-only resource lookup.
func CanonicalResourceLookupPath ¶
CanonicalResourceLookupPath returns the shared canonical form used for Unicode-stable resource and asset path lookup.
func LessRecentNote ¶
LessRecentNote orders notes by published time descending, then slug ascending.
func NormalizeTagName ¶
NormalizeTagName applies the shared canonical tag contract used by indexing and rendering.
Types ¶
type BacklinkEntry ¶
BacklinkEntry represents a backlink listed on a note page.
type Breadcrumb ¶
Breadcrumb represents one navigation breadcrumb item.
type Frontmatter ¶
type Frontmatter struct {
Title string
Description string
Date time.Time
Updated time.Time
Tags []string
Aliases []string
Publish *bool
Slug string
Extra map[string]any
}
Frontmatter holds the supported YAML frontmatter fields plus unknown extras.
type LinkRef ¶
type LinkRef struct {
// RawTarget is captured from the source wikilink during AST extraction.
RawTarget string
// ResolvedRelPath is filled on render-time link copies once RawTarget matches a note.
ResolvedRelPath string
Display string
Fragment string
Line int
Offset int
}
LinkRef records an outbound wikilink across extraction and resolution phases.
type Note ¶
type Note struct {
RelPath string
Frontmatter Frontmatter
LastModified time.Time
Slug string
Aliases []string
Tags []string
Headings []Heading
HeadingSections map[string]SectionRange
RawContent []byte
BodyStartLine int
HTMLContent string
Summary string
OutLinks []LinkRef
Embeds []EmbedRef
ImageRefs []ImageRef
HasMath bool
HasMermaid bool
}
Note describes a Markdown note discovered in a vault.
func (*Note) PublishedAt ¶
PublishedAt returns the best available article timestamp for this note.
type NoteSummary ¶
type NoteSummary struct {
Title string
Summary string
URL string
Date time.Time
LastModified time.Time
Tags []TagLink
}
NoteSummary is the compact note representation used in list pages.
type PageData ¶
type PageData struct {
Kind PageKind
Site SiteConfig
SiteRootRel string
Title string
TitleID string
Description string
Slug string
Canonical string
RelPath string
Content template.HTML
TOC []TOCEntry
Date time.Time
LastModified time.Time
ReadingTime string
WordCount int
Tags []TagLink
Backlinks []BacklinkEntry
RelatedArticles []RelatedArticle
HasMath bool
HasMermaid bool
HasSearch bool
HasCustomCSS bool
HasRSS bool
TagName string
TagNotes []NoteSummary
ChildTags []TagLink
FolderPath string
FolderChildren []NoteSummary
RecentNotes []NoteSummary
TimelineNotes []NoteSummary
Pagination *PaginationData
SidebarTree []SidebarNode
OG OpenGraph
TwitterCard string
JSONLD template.JS
Breadcrumbs []Breadcrumb
}
PageData is the shared template contract for all rendered pages.
type PageKind ¶
type PageKind string
PageKind identifies the template variant represented by PageData.
type PaginationConfig ¶
type PaginationConfig struct {
PageSize int
}
PaginationConfig controls list-page pagination behavior.
type PaginationData ¶
type PaginationData struct {
CurrentPage int
TotalPages int
PrevURL string
NextURL string
Pages []PageLink
}
PaginationData contains page-navigation metadata for list pages.
type PathLookupResult ¶
PathLookupResult describes an exact or canonical resource lookup.
Path is populated when lookup succeeds. Ambiguous is populated when canonical fallback matched multiple vault-relative paths and lookup intentionally refuses to choose a winner.
type PopoverConfig ¶
type PopoverConfig struct {
Enabled bool
}
PopoverConfig controls internal-link preview generation.
type RelatedArticle ¶
RelatedArticle contains precomputed related-content metadata for a note page.
type RelatedConfig ¶
RelatedConfig controls related-article generation.
type SearchConfig ¶
SearchConfig configures optional Pagefind-based search output.
type SectionRange ¶
SectionRange identifies a source slice within Note.RawContent.
type SidebarConfig ¶
type SidebarConfig struct {
Enabled bool
}
SidebarConfig controls the optional collapsible sidebar file tree.
type SidebarNode ¶
type SidebarNode struct {
Name string `json:"name"`
URL string `json:"url"`
IsDir bool `json:"isDir"`
IsActive bool `json:"isActive"`
Children []SidebarNode `json:"children,omitempty"`
}
SidebarNode represents one node in the rendered sidebar file tree.
type SiteConfig ¶
type SiteConfig struct {
Title string
BaseURL string
Author string
Description string
Language string
DefaultPublish bool
DefaultPublishSet bool
DefaultImg string
Themes map[string]ThemeConfig
DefaultTheme string
ActiveThemeName string
ThemeRoot string
CustomCSS string
Search SearchConfig
Pagination PaginationConfig
Sidebar SidebarConfig
Popover PopoverConfig
Related RelatedConfig
RSS RSSConfig
Timeline TimelineConfig
KaTeXCSSURL string
KaTeXJSURL string
KaTeXAutoRenderURL string
MermaidJSURL string
}
SiteConfig is the stable site-level configuration contract shared across packages. URL-like fields intentionally remain plain strings so html/template keeps contextual escaping. DefaultPublishSet and RSS.EnabledSet disambiguate explicit false from shared product defaults, which resolve to true when unset.
func (SiteConfig) EffectiveDefaultPublish ¶
func (cfg SiteConfig) EffectiveDefaultPublish() bool
EffectiveDefaultPublish returns the resolved publish policy for notes that do not set frontmatter publish.
func (SiteConfig) EffectiveRSSEnabled ¶
func (cfg SiteConfig) EffectiveRSSEnabled() bool
EffectiveRSSEnabled returns the resolved RSS policy for the site.
type ThemeConfig ¶
type ThemeConfig struct {
Root string
}
ThemeConfig describes a named build-time theme root.
type TimelineConfig ¶
TimelineConfig controls the recent-notes timeline page.
type UnpublishedLookup ¶
type UnpublishedLookup struct {
Notes map[string]*Note
NoteByName map[string][]*Note
AliasByName map[string][]*Note
}
UnpublishedLookup retains enough metadata for later path/name/alias resolution after unpublished notes are removed from the public lookup tables.
type VaultIndex ¶
type VaultIndex struct {
AttachmentFolderPath string
Notes map[string]*Note
NoteBySlug map[string]*Note
NoteByName map[string][]*Note
AliasByName map[string][]*Note
Tags map[string]*Tag
Assets map[string]*Asset
AssetLookup map[string]string
Resources map[string]string
ResourceBaseNames map[string]string
Unpublished UnpublishedLookup
// contains filtered or unexported fields
}
VaultIndex is the immutable handoff between pass 1 indexing and pass 2 rendering. Pass 2 must clone any per-render note state instead of mutating notes held here.
Exact asset and resource sets remain the source of truth. Derived canonical fallback tables are populated eagerly by constructors like BuildIndex and are also rebuilt lazily on first lookup so tests and callers cannot observe a half-initialized handoff object.
func (*VaultIndex) HasResource ¶
func (idx *VaultIndex) HasResource(relPath string) bool
func (*VaultIndex) HasResourceBaseName ¶
func (idx *VaultIndex) HasResourceBaseName(name string) bool
func (*VaultIndex) LookupAssetPath ¶
func (idx *VaultIndex) LookupAssetPath(relPath string) PathLookupResult
func (*VaultIndex) LookupResourceBaseName ¶
func (idx *VaultIndex) LookupResourceBaseName(name string) PathLookupResult
func (*VaultIndex) LookupResourcePath ¶
func (idx *VaultIndex) LookupResourcePath(relPath string) PathLookupResult
func (*VaultIndex) ResolveAssetPath ¶
func (idx *VaultIndex) ResolveAssetPath(relPath string) string
func (*VaultIndex) ResolveResourceBaseName ¶
func (idx *VaultIndex) ResolveResourceBaseName(name string) string
func (*VaultIndex) ResolveResourcePath ¶
func (idx *VaultIndex) ResolveResourcePath(relPath string) string
func (*VaultIndex) SetAssets ¶
func (idx *VaultIndex) SetAssets(assets map[string]*Asset)
func (*VaultIndex) SetResources ¶
func (idx *VaultIndex) SetResources(resourceFiles []string)