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::Unknownto keep consumers resilient. - provides a plugin sdk for external snippet renderers (
pluginmodule).
§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§
Structs§
- Attachment
Resolver - Resolves attachment targets relative to the knowledge base root.
- Broken
Link - A link target that could not be resolved to any known page.
- Duplicate
Title - A set of pages that share the same title (case-insensitive).
- Inline
Link - A single inline link located within a text run.
- Inline
Links - Iterator returned by
scan_inline_links. - Knowledge
Base - Entry point for opening a Lepiter knowledge base directory.
- Knowledge
Base Index - Indexed knowledge base metadata with lazy page loading.
- Link
Analysis Result - Result of
KnowledgeBaseIndex::scan_all_pages. - Link
Edge - A directed edge in the page link graph.
- Link
Graph - Directed link graph across all pages in a knowledge base.
- Missing
Attachment - An attachment reference that points to a file not found on disk.
- Page
- Fully parsed page content.
- Page
Load Error - A page that could not be loaded during link analysis.
- Page
Meta - Metadata for a page discovered during index scanning.
- Parse
Issue - Non-fatal parse/indexing issue associated with a source file.
- Resolved
Attachment - Resolved attachment target.
- Search
Hit - Search result entry for one page.
Enums§
- Attachment
Error - Attachment resolution failures.
- Link
Kind - Which inline-link syntax produced an
InlineLink. - Link
Target Kind - Classification of a raw link target.
- Node
- Block-oriented normalized node model used by consumers (e.g. TUI).
- Search
Match Kind - Match category for search results.
- Title
Resolution - Result of resolving a page by title.
Functions§
- collect_
node_ types_ in_ file - Collects all observed
type/__typevalues 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
trueif 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
textand yields each[[wikilink]]/[label](target)it contains, in source order.
Type Aliases§
- PageId
- Canonical page identifier used throughout the API.