Skip to main content

docspec_core/
lib.rs

1//! Core event types and traits for the `DocSpec` streaming document conversion library.
2//!
3//! `DocSpec` converts documents through a streaming event pipeline. This crate defines
4//! the [`Event`] enum, supporting types, error types, and the [`EventSource`],
5//! [`EventSink`], and [`AssetProvider`] traits that decouple readers from writers.
6//!
7//! # Quick Start
8//!
9//! Implement [`EventSource`] to produce events and [`EventSink`] to consume them.
10//! Events represent document structure (headings, paragraphs, tables, text runs).
11//! Readers and writers are fully decoupled through the event protocol.
12//!
13//! # Event Types
14//!
15//! The [`Event`] enum covers all document structures defined in the `DocSpec`
16//! specification. See `EVENTS.md` for the authoritative variant list and semantics.
17
18extern crate alloc;
19
20mod depth;
21mod error;
22mod event;
23mod pipeline;
24mod stack;
25mod traits;
26mod types;
27
28pub use depth::Depth;
29pub use error::{Error, Position, Result};
30pub use event::{Event, TextStyle};
31pub use pipeline::pipe;
32pub use stack::{block_kind_for_end, block_kind_for_start, BlockKind, StackTrackingSink};
33pub use traits::{AssetProvider, EventSink, EventSource};
34pub use types::{
35    Author, Color, DocumentMeta, ImageSource, ListStyleType, TableHeaderScope, TextAlignment,
36};