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 converters::ConversionFormat;
pub use converters::Converter;
pub use converters::Convertible;
pub use document::Document;
pub use error::BlocksError;
pub use error::Result;

Modules§

block
converters
document
error

Constants§

VERSION
Current version of the blocks library