Expand description
Agent-facing K2F SDK: edit by node id, Markdown bridge, PDF export.
§Example
use k2f_sdk::Editor;
use std::path::Path;
let mut editor = Editor::open_dir(Path::new("./source")).unwrap();
editor.insert_node(
"root",
0,
r#"{"id":"doc.title","role":"h1","content":{"type":"text","value":"Hello"}}"#,
)
.unwrap();
let bytes = editor.save_bytes().unwrap();
assert!(!bytes.is_empty());Structs§
- Agent
Error - Change
- Changelog
Entry - Changelog
File - Conversion
Report - Editor
- Surgical editor: mutate the semantic tree, then relock. Does not edit lock x/y.
- Generated
Key - Markdown
Options - Markdown
Result - Outline
Node - PdfExport
Options - PDF export settings. By default exports only the lock pages (no captions or verify page).
Enums§
Constants§
- CONTENT_
HASH_ MISMATCH - DOCX_
IS_ NOT_ A_ SOURCE - DUPLICATE_
ID - FONT_
MISSING - IDML_
IS_ NOT_ A_ SOURCE - IMAGE_
SIZE - INVALID_
ARGUMENT - INVALID_
ID - INVALID_
MODIFIER - PDF_
IS_ NOT_ A_ SOURCE - PPTX_
IS_ NOT_ A_ SOURCE - SCHEMA_
INVALID - SVG_
TEXT - SYSTEM_
PROMPT - TABLE_
ROW_ MISMATCH - UNKNOWN_
ID - UNKNOWN_
ROLE - WRONG_
CONTENT
Functions§
- export_
docx - export_
idml - export_
idml_ only - export_
pdf - export_
pdf_ at - export_
pdf_ with - export_
pptx - format_
schemas - Pack-path keys (e.g.
schema/nodes.schema.json) → embedded format schema JSON text. - generate_
key - k2f_
to_ markdown - markdown_
to_ k2f - parse_
pdf_ scale - sign
- Sign a compiled package. Agents save unsigned; a human/org key signs the lock bytes.
signed_atis UTC unix seconds. None uses the current UTC time. - validate_
agent_ json