Summary
Add script-driven export of notes to CSV, JSON, and Markdown. Export views are registered per-schema in Rhai scripts using three new functions — register_csv_export, register_json_export, register_markdown_export — following the same deferred binding pattern as register_view.
Exports are anchored on container/folder notes. The script callback drives traversal (iterating children, following links, filtering by tag) using the full QueryContext already available to view closures.
Key Design Decisions
- Three format-specific registration functions — each with a tailored return type (CSV:
Array<Map> with flat scalar values, JSON: Array<Map> with arbitrary nesting, Markdown: String)
- Preview before save — clicking an export opens a preview dialog; from there the user can save to file or copy to clipboard
- Context menu trigger — right-click a note → "Export" submenu lists available exports for that schema
note.to_map() helper — convenience function that flattens a note into a single-level map for easy CSV/JSON authoring
- Expand
build_note_map() — expose all Note properties to Rhai (currently missing: parent_id, position, created_at, modified_at, created_by, modified_by, is_expanded, schema_version). Benefits existing register_view closures too.
Script API Example
register_csv_export("BookCollection", "Book List", |note| {
let books = get_children(note.id);
let rows = [];
for book in books {
rows.push(#{
title: book.title,
author: book.fields["author"] ?? "",
rating: book.fields["rating"] ?? ""
});
}
rows
});
Scope
Rust Core (krillnotes-core)
- Three new
BindingKind variants + registration functions in engine.rs
ExportFormat enum + ExportRegistration struct in schema.rs
export_registrations HashMap in SchemaRegistry
Workspace::run_export() and Workspace::list_exports() methods
to_map() Rhai helper function
- Expand
build_note_map() with all Note fields
Tauri Commands
list_note_exports — returns available exports for a note
run_note_export — executes export callback, returns content string
Frontend
- Context menu "Export" submenu in
ContextMenu.tsx
- New
ExportPreviewDialog.tsx — preview content, save to file, copy to clipboard
- i18n keys across all 7 locales
Example Scripts
- Add CSV, JSON, Markdown exports to
book-collection.rhai
Design Spec
Full spec: docs/superpowers/specs/2026-04-29-text-export-views-design.md
Summary
Add script-driven export of notes to CSV, JSON, and Markdown. Export views are registered per-schema in Rhai scripts using three new functions —
register_csv_export,register_json_export,register_markdown_export— following the same deferred binding pattern asregister_view.Exports are anchored on container/folder notes. The script callback drives traversal (iterating children, following links, filtering by tag) using the full
QueryContextalready available to view closures.Key Design Decisions
Array<Map>with flat scalar values, JSON:Array<Map>with arbitrary nesting, Markdown:String)note.to_map()helper — convenience function that flattens a note into a single-level map for easy CSV/JSON authoringbuild_note_map()— expose all Note properties to Rhai (currently missing:parent_id,position,created_at,modified_at,created_by,modified_by,is_expanded,schema_version). Benefits existingregister_viewclosures too.Script API Example
Scope
Rust Core (krillnotes-core)
BindingKindvariants + registration functions inengine.rsExportFormatenum +ExportRegistrationstruct inschema.rsexport_registrationsHashMap inSchemaRegistryWorkspace::run_export()andWorkspace::list_exports()methodsto_map()Rhai helper functionbuild_note_map()with all Note fieldsTauri Commands
list_note_exports— returns available exports for a noterun_note_export— executes export callback, returns content stringFrontend
ContextMenu.tsxExportPreviewDialog.tsx— preview content, save to file, copy to clipboardExample Scripts
book-collection.rhaiDesign Spec
Full spec:
docs/superpowers/specs/2026-04-29-text-export-views-design.md