Skip to main content

Crate lepiter_core

Crate lepiter_core 

Source
Expand description

core data model and parser for lepiter knowledge bases stored as page json files.

§scope

  • scans a lepiter directory and builds a metadata index keyed by page id.
  • loads and parses individual pages lazily by id.
  • converts page snippet trees into a stable block-oriented node model.
  • preserves unknown node types as Node::Unknown to keep consumers resilient.
  • provides a plugin sdk for external snippet renderers (plugin module).

§example

use lepiter_core::KnowledgeBase;

let index = KnowledgeBase::open("./lepiter")?;
for page in index.sorted_pages() {
    println!("{} - {}", page.id, page.title);
}

§plugin sdk

use lepiter_core::plugin::{PluginRequest, PluginResponse};
use lepiter_core::lepiter_plugin_main;

fn handle(req: PluginRequest) -> PluginResponse {
    if req.typ != "wardleyMap" {
        return PluginResponse::error("unsupported type");
    }
    PluginResponse::ok(vec!["example".to_string()])
}

lepiter_plugin_main!(handle);

Modules§

plugin
plugin sdk for external snippet renderers.

Macros§

lepiter_plugin_main

Structs§

AttachmentResolver
Resolves attachment targets relative to the knowledge base root.
KnowledgeBase
Entry point for opening a Lepiter knowledge base directory.
KnowledgeBaseIndex
Indexed knowledge base metadata with lazy page loading.
Page
Fully parsed page content.
PageMeta
Metadata for a page discovered during index scanning.
ParseIssue
Non-fatal parse/indexing issue associated with a source file.
ResolvedAttachment
Resolved attachment target.
SearchHit
Search result entry for one page.

Enums§

AttachmentError
Attachment resolution failures.
LinkTargetKind
Classification of a raw link target.
Node
Block-oriented normalized node model used by consumers (e.g. TUI).
SearchMatchKind
Match category for search results.
TitleResolution
Result of resolving a page by title.

Functions§

collect_node_types_in_file
Collects all observed type/__type values and their counts in one page file.
normalize_text
parse_node_from_raw
Parses a single raw snippet JSON value into a Node.
render_nodes_to_text
Renders normalized nodes to plain text.
render_page_to_text
Renders a parsed page to plain text.

Type Aliases§

PageId
Canonical page identifier used throughout the API.