wiki

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package wiki contains the shared Markdown/wiki parsing and normalization rules that define canonical Knowl workspace semantics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Body added in v0.3.0

func Body(content string) string

Body returns the user-authored Markdown after a valid leading frontmatter block. Content without a complete leading block is returned unchanged.

func ConceptLinks(from knowl.PageID, content string) []knowl.LinkReference

ConceptLinks extracts bounded standard Markdown links to OKF concepts and resolves them relative to the canonical page ID. External, asset, anchor, unsafe, and malformed destinations are ignored.

func IndexDestinations added in v0.3.0

func IndexDestinations(content string, limit int) ([]string, bool)

IndexDestinations returns bounded raw internal-link candidates from an OKF catalog. Resolution remains the caller's responsibility because nested catalogs resolve relative paths from their own directory.

func IndexTargets

func IndexTargets(content string) ([]string, bool)

IndexTargets extracts both wiki links and bare list-item targets from index content.

func Links(from knowl.PageID, content string) []knowl.LinkReference

Links converts normalized page targets into unique wiki link references.

func MarkdownTargets

func MarkdownTargets(content string) ([]string, bool)

MarkdownTargets extracts normalized wiki-link targets from Markdown.

func MigrateLegacyEnvelope added in v0.3.0

func MigrateLegacyEnvelope(metadata okf.Metadata) (okf.Metadata, bool, error)

MigrateLegacyEnvelope moves the legacy flat Knowl-owned fields into the namespaced extension without changing standard OKF fields or user content.

func NormalizePageTarget

func NormalizePageTarget(target string) string

NormalizePageTarget converts a wiki reference into a canonical page ID.

func PageIDFromPath

func PageIDFromPath(path string) (knowl.PageID, bool)

PageIDFromPath derives the canonical page ID from a wiki Markdown path.

func ResolveIndexDestination added in v0.3.0

func ResolveIndexDestination(catalogPath, raw string) (target string, external bool, valid bool)

ResolveIndexDestination resolves one catalog destination to a bundle-relative Markdown path. External and anchor destinations are valid but do not participate in the catalog graph.

func SourceDocument added in v0.3.0

func SourceDocument(content string) *knowl.SourceDocument

SourceDocument returns a copy of optional structured source provenance.

func SourceRefs

func SourceRefs(content string) []string

SourceRefs returns a deterministic, deduplicated source-ref list.

Types

type Frontmatter

type Frontmatter struct {
	ID             string                `yaml:"id"`
	Title          string                `yaml:"title"`
	Type           string                `yaml:"type"`
	SourceRefs     []string              `yaml:"source_refs"`
	SourceDocument *knowl.SourceDocument `yaml:"source_document,omitempty"`
	Legacy         bool                  `yaml:"-"`
}

Frontmatter is the bounded YAML metadata recognized on ordinary pages.

func FrontmatterFromMetadata added in v0.3.0

func FrontmatterFromMetadata(concept okf.Metadata) (Frontmatter, error)

FrontmatterFromMetadata extracts the Knowl envelope from already parsed OKF metadata without decoding the concept again.

func ParseFrontmatter

func ParseFrontmatter(content string) (Frontmatter, error)

ParseFrontmatter reads canonical namespaced Knowl metadata and retains deterministic compatibility with the legacy flat envelope.

Jump to

Keyboard shortcuts

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