Documentation
¶
Overview ¶
Package wiki contains the shared Markdown/wiki parsing and normalization rules that define canonical Knowl workspace semantics.
Index ¶
- func Body(content string) string
- func ConceptLinks(from knowl.PageID, content string) []knowl.LinkReference
- func IndexDestinations(content string, limit int) ([]string, bool)
- func IndexTargets(content string) ([]string, bool)
- func Links(from knowl.PageID, content string) []knowl.LinkReference
- func MarkdownTargets(content string) ([]string, bool)
- func MigrateLegacyEnvelope(metadata okf.Metadata) (okf.Metadata, bool, error)
- func NormalizePageTarget(target string) string
- func PageIDFromPath(path string) (knowl.PageID, bool)
- func ResolveIndexDestination(catalogPath, raw string) (target string, external bool, valid bool)
- func SourceDocument(content string) *knowl.SourceDocument
- func SourceRefs(content string) []string
- type Frontmatter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Body ¶ added in v0.3.0
Body returns the user-authored Markdown after a valid leading frontmatter block. Content without a complete leading block is returned unchanged.
func ConceptLinks ¶ added in v0.3.0
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
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 ¶
IndexTargets extracts both wiki links and bare list-item targets from index content.
func Links ¶
func Links(from knowl.PageID, content string) []knowl.LinkReference
Links converts normalized page targets into unique wiki link references.
func MarkdownTargets ¶
MarkdownTargets extracts normalized wiki-link targets from Markdown.
func MigrateLegacyEnvelope ¶ added in v0.3.0
MigrateLegacyEnvelope moves the legacy flat Knowl-owned fields into the namespaced extension without changing standard OKF fields or user content.
func NormalizePageTarget ¶
NormalizePageTarget converts a wiki reference into a canonical page ID.
func PageIDFromPath ¶
PageIDFromPath derives the canonical page ID from a wiki Markdown path.
func ResolveIndexDestination ¶ added in v0.3.0
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 ¶
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.