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 [`AssetHandle`] 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 supported by `DocSpec`. See
16//! the [`event`] module for the full event reference, well-formedness rules, and
17//! per-variant semantics.
18
19extern crate alloc;
20
21mod depth;
22mod error;
23pub mod event;
24mod pipeline;
25mod skip_empty_blocks;
26mod stack;
27mod style;
28mod traits;
29mod types;
30
31pub use depth::Depth;
32pub use error::{Error, Position, Result};
33pub use event::{Event, TextStyleKind};
34pub use pipeline::pipe;
35pub use skip_empty_blocks::SkipEmptyBlocks;
36pub use stack::{block_kind_for_end, block_kind_for_start, BlockKind, StackTrackingSink};
37pub use style::{StyleStack, MAX_STYLE_DEPTH};
38pub use traits::{AssetHandle, EventSink, EventSource};
39pub use types::{
40    Author, Color, DocumentMeta, ImageSource, ListStyleType, TableHeaderScope, TextAlignment,
41};