// UniFFI interface definition for MBR QuickLook plugin
// This defines the FFI boundary between Rust and Swift
namespace mbr {
// Render a file to a self-contained QuickLook preview: one HTML document
// plus the local files it references, ready to become a QLPreviewReply.
[Throws=QuickLookError]
PreviewDocument render_preview(string file_path, string? config_root);
// Render with custom configuration options
[Throws=QuickLookError]
PreviewDocument render_preview_with_config(string file_path, string? config_root, QuickLookConfig config);
// Find the repository/config root directory by searching upward for markers
// (.mbr, .git, .zk, .obsidian, book.toml, mkdocs.yml, docusaurus.config.js)
// Falls back to the file's parent directory if no markers found
string find_config_root(string file_path);
};
// Error types that can be returned from the API
// Using interface-style errors to include descriptive messages
[Error]
interface QuickLookError {
FileReadError(string message);
MarkdownRenderError(string message);
TemplateRenderError(string message);
ConfigError(string message);
InvalidPathEncoding();
};
// Configuration options for QuickLook rendering
dictionary QuickLookConfig {
boolean include_syntax_highlighting;
boolean include_mermaid;
};
// One local file the preview HTML references, as `cid:{id}`.
// `path` is absolute, canonical, and already proven to be a regular file
// inside the previewed repository - see collect_preview_attachments.
dictionary PreviewAttachment {
string id;
string path;
};
// A rendered preview: the HTML document and every local file it needs.
dictionary PreviewDocument {
string html;
sequence<PreviewAttachment> attachments;
};