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.
BrokenLink
A link target that could not be resolved to any known page.
DuplicateTitle
A set of pages that share the same title (case-insensitive).
InlineLink
A single inline link located within a text run.
InlineLinks
Iterator returned by scan_inline_links.
KnowledgeBase
Entry point for opening a Lepiter knowledge base directory.
KnowledgeBaseIndex
Indexed knowledge base metadata with lazy page loading.
LinkAnalysisResult
Result of KnowledgeBaseIndex::scan_all_pages.
LinkEdge
A directed edge in the page link graph.
LinkGraph
Directed link graph across all pages in a knowledge base.
MissingAttachment
An attachment reference that points to a file not found on disk.
Page
Fully parsed page content.
PageLoadError
A page that could not be loaded during link analysis.
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.
LinkKind
Which inline-link syntax produced an InlineLink.
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.
extract_link_targets
Extracts raw link target strings from a node tree.
extract_type
Extracts the snippet type from a JSON value, checking "type" then "__type".
is_code_snippet
Returns true if the given snippet type name is a code snippet.
normalize_text
page_content_contains
Checks whether the rendered text of a page contains needle (case-insensitive) without allocating the full rendered string.
parse_heading
Parses a markdown-style heading line, returning the level (1–6) and 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_nodes_to_text_with
Renders normalized nodes to plain text, rewriting inline and explicit links through rewrite.
render_page_to_text
Renders a parsed page to plain text.
rewrite_inline_links
Rewrites the inline links in text, leaving everything else byte-for-byte intact.
scan_inline_links
Walks text and yields each [[wikilink]] / [label](target) it contains, in source order.

Type Aliases§

PageId
Canonical page identifier used throughout the API.