Crate blocks

Crate blocks 

Source
Expand description

§Blocks Editor Library

A high-performance Rust library for creating and converting block-based content to Markdown and HTML formats.

§Features

  • Support for multiple block types (text, headers, lists, code, quotes, links, images)
  • Efficient conversion to Markdown and HTML
  • Type-safe block system with comprehensive error handling
  • Zero-copy operations where possible
  • Well-tested with property-based testing

§Example

use blocks::{Block, BlockType, Document, ConversionFormat};

let mut doc = Document::new();
doc.add_block(Block::new(
    BlockType::Header { level: 1 },
    "Hello World".to_string()
));

let markdown = doc.to_format(ConversionFormat::Markdown).unwrap();
assert_eq!(markdown, "# Hello World\n\n");

Re-exports§

pub use block::Block;
pub use block::BlockType;
pub use block::ButtonStyle;
pub use block::CalloutType;
pub use block::EmbedType;
pub use block::ListType;
pub use builders::BlockBuilder;
pub use builders::DocumentBuilder;
pub use cache::CacheStats;
pub use cache::ConversionCache;
pub use converters::ConversionFormat;
pub use converters::Converter;
pub use converters::Convertible;
pub use converters::JsonSerializable;
pub use diff::Change;
pub use diff::DiffResult;
pub use diff::DocumentDiffer;
pub use diff::DocumentMerger;
pub use diff::MergeStrategy;
pub use document::Document;
pub use error::BlocksError;
pub use error::Result;
pub use history::DocumentOperation;
pub use history::HistoryManager;
pub use pipeline::block_middlewares;
pub use pipeline::document_middlewares;
pub use pipeline::BlockPipeline;
pub use pipeline::DocumentPipeline;
pub use plugins::BlockProcessor;
pub use plugins::BlockValidator;
pub use plugins::ContentTransformer;
pub use plugins::PluginRegistry;
pub use sanitizer::ContentSanitizer;
pub use stats::BlockStats;
pub use stats::DocumentAnalyzer;
pub use stats::DocumentIssue;
pub use stats::DocumentStats;
pub use stats::IssueSeverity;

Modules§

block
builders
cache
converters
diff
document
error
history
pipeline
plugins
sanitizer
stats

Constants§

VERSION
Current version of the blocks library