quillmark_core/lib.rs
1//! # Quillmark Core Overview
2//!
3//! Core types and functionality for the Quillmark format-first Markdown rendering system.
4//!
5//! ## Features
6//!
7//! This crate provides the foundational types and traits for Quillmark:
8//!
9//! - **Parsing**: YAML frontmatter extraction with Extended YAML Metadata Standard support
10//! - **Format model**: [`QuillSource`] type for managing format bundles with in-memory file system
11//! - **Backend trait**: Extensible interface for implementing output format backends
12//! - **Error handling**: Structured diagnostics with source location tracking
13//! - **Utilities**: TOML⇄YAML conversion helpers
14//!
15//! ## Quick Start
16//!
17//! ```no_run
18//! use quillmark_core::Document;
19//!
20//! // Parse markdown with frontmatter
21//! let markdown = "---\nQUILL: my_quill\ntitle: Example\n---\n\n# Content";
22//! let doc = Document::from_markdown(markdown).unwrap();
23//! let title = doc.main()
24//! .frontmatter()
25//! .get("title")
26//! .and_then(|v| v.as_str())
27//! .unwrap_or("Untitled");
28//! assert_eq!(title, "Example");
29//! ```
30//!
31//! ## Architecture
32//!
33//! The crate is organized into modules:
34//!
35//! - [`document`]: Markdown parsing with YAML frontmatter support
36//! - [`backend`]: Backend trait for output format implementations
37//! - [`error`]: Structured error handling and diagnostics
38//! - [`types`]: Core rendering types (OutputFormat, Artifact, RenderOptions)
39//! - [`quill`]: QuillSource bundle and related types
40//!
41//! ## Further Reading
42//!
43//! - [PARSE.md](https://github.com/nibsbin/quillmark/blob/main/designs/PARSE.md) - Detailed parsing documentation
44//! - [Examples](https://github.com/nibsbin/quillmark/tree/main/examples) - Working examples
45
46pub mod document;
47pub use document::{
48 Card, Document, EditError, Frontmatter, FrontmatterItem, ParseOutput, Sentinel,
49};
50
51pub mod backend;
52pub use backend::Backend;
53
54pub mod error;
55pub use error::{Diagnostic, Location, ParseError, RenderError, RenderResult, Severity};
56
57pub mod types;
58pub use types::{Artifact, OutputFormat, RenderOptions};
59
60pub mod session;
61pub use session::RenderSession;
62
63pub mod quill;
64pub use quill::{FileTreeNode, QuillIgnore, QuillSource};
65
66pub mod value;
67pub use value::QuillValue;
68
69pub mod normalize;
70pub use normalize::{
71 normalize_document, normalize_fields, normalize_markdown, strip_bidi_formatting,
72 NormalizationError,
73};
74
75pub mod version;
76pub use version::{QuillReference, Version, VersionSelector};