okf

package
v0.2.21 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: MIT Imports: 26 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ProfilePrivate = "private"
)

Variables

This section is empty.

Functions

func EntityConceptID

func EntityConceptID(kind, key string) string

func EntityPath

func EntityPath(kind, key string) string

func ItemConceptID

func ItemConceptID(item model.Item) string

func ItemPath

func ItemPath(item model.Item) string
func MarkdownLink(label, dest string) string
func RelativeLink(fromPath, toPath string) (string, error)

func RenderDocument

func RenderDocument(doc Document) (string, error)

func SourceConceptID

func SourceConceptID(source model.SourceDocument) string

func SourcePath

func SourcePath(source model.SourceDocument) string

func TopicConceptID

func TopicConceptID(topic string) string

func TopicPath

func TopicPath(topic string) string

func ValidateConceptPath

func ValidateConceptPath(rel string) error

Types

type Bundle

type Bundle struct {
	Documents []Document
	Manifest  Manifest
	Stats     ExportResult
}

func BuildBundle

func BuildBundle(snapshot store.OKFExportSnapshot, opts ExportOptions) (Bundle, error)

type Concept

type Concept struct {
	Path        string         `json:"path"`
	Type        string         `json:"type"`
	Title       string         `json:"title"`
	Description string         `json:"description"`
	ConceptID   string         `json:"dbrain_concept_id"`
	SourceKey   string         `json:"dbrain_source_key,omitempty"`
	SourceType  string         `json:"dbrain_source_type,omitempty"`
	Frontmatter map[string]any `json:"frontmatter"`
	Markdown    string         `json:"markdown"`
	Body        string         `json:"body"`
}

func GetBundleConcept

func GetBundleConcept(root string, lookup string) (Concept, error)

type Document

type Document struct {
	Path        string
	Type        string
	Title       string
	Description string
	Resource    string
	Tags        []string
	Timestamp   string
	Fields      []Field
	Body        string
}

type ExportOptions

type ExportOptions struct {
	OutDir             string
	Profile            string
	IncludeItems       bool
	IncludeSources     bool
	IncludeEntities    bool
	IncludeTopics      bool
	SourceTypes        []string
	Limit              int
	IncludeRaw         bool
	MaxRawChars        int
	MediaPublicBaseURL string
	MediaProxyBaseURL  string
	Now                time.Time
	DbrainVersion      string
	Entities           []entities.Entity
	Topics             []topics.TopicMap
}

type ExportResult

type ExportResult struct {
	Bundle               string   `json:"bundle"`
	Profile              string   `json:"profile"`
	ItemsWritten         int      `json:"items_written"`
	SourcesWritten       int      `json:"sources_written"`
	EntitiesWritten      int      `json:"entities_written"`
	TopicsWritten        int      `json:"topics_written"`
	IndexesWritten       int      `json:"indexes_written"`
	ConceptsWritten      int      `json:"concepts_written"`
	BrokenInternalLinks  int      `json:"broken_internal_links"`
	OmittedByFilterLinks int      `json:"omitted_by_filter_links"`
	Errors               []string `json:"errors"`
}

func Export

func Export(ctx context.Context, cfg config.Config, st *store.Store, opts ExportOptions) (ExportResult, error)

type Field

type Field struct {
	Name  string
	Value any
}

type Manifest

type Manifest struct {
	OKFVersion   string            `json:"okf_version"`
	Profile      string            `json:"profile"`
	ExportedAt   string            `json:"exported_at"`
	Concepts     []ManifestConcept `json:"concepts"`
	OmittedLinks []OmittedLink     `json:"omitted_links,omitempty"`
}

type ManifestConcept

type ManifestConcept struct {
	Path        string `json:"path"`
	Type        string `json:"type"`
	Title       string `json:"title"`
	Description string `json:"description"`
	ConceptID   string `json:"dbrain_concept_id"`
	Kind        string `json:"dbrain_kind"`
	SourceKey   string `json:"dbrain_source_key,omitempty"`
	SourceType  string `json:"dbrain_source_type,omitempty"`
}
type OmittedLink struct {
	FromPath        string `json:"from_path"`
	TargetPath      string `json:"target_path"`
	TargetConceptID string `json:"target_concept_id,omitempty"`
	Reason          string `json:"reason"`
}

type SearchResult

type SearchResult struct {
	Path        string `json:"path"`
	Type        string `json:"type"`
	Title       string `json:"title"`
	Description string `json:"description"`
	ConceptID   string `json:"dbrain_concept_id"`
	SourceKey   string `json:"dbrain_source_key,omitempty"`
	SourceType  string `json:"dbrain_source_type,omitempty"`
	Snippet     string `json:"snippet,omitempty"`
}

func SearchBundle

func SearchBundle(root string, query string, limit int) ([]SearchResult, error)

type ValidationDocument

type ValidationDocument struct {
	Path  string `json:"path"`
	Type  string `json:"type,omitempty"`
	Title string `json:"title,omitempty"`
	Error string `json:"error,omitempty"`
}

type ValidationResult

type ValidationResult struct {
	Bundle               string               `json:"bundle"`
	Conformant           bool                 `json:"conformant"`
	Concepts             int                  `json:"concepts"`
	Indexes              int                  `json:"indexes"`
	BrokenInternalLinks  int                  `json:"broken_internal_links"`
	OmittedByFilterLinks int                  `json:"omitted_by_filter_links"`
	Errors               []string             `json:"errors"`
	Documents            []ValidationDocument `json:"documents,omitempty"`
}

func ValidateBundle

func ValidateBundle(root string) (ValidationResult, error)

Jump to

Keyboard shortcuts

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