markdown_ppp/ast_transform/mod.rs
1//! AST transformation and manipulation utilities
2//!
3//! This module provides a comprehensive set of tools for transforming and querying Markdown AST:
4//! - Visitor pattern for read-only traversal
5//! - Transformer pattern for AST modifications
6//! - Query API for finding elements by conditions
7//! - Convenience methods for common transformations
8//! - Pipeline builder for composing complex transformations
9//!
10//! # Examples
11//!
12//! ```rust
13//! use markdown_ppp::ast::*;
14//! use markdown_ppp::ast_transform::*;
15//!
16//! // Create a simple document
17//! let doc = Document {
18//! blocks: vec![
19//! Block::Paragraph(vec![
20//! Inline::Text("hello world".to_string()),
21//! ]),
22//! ],
23//! };
24//!
25//! // Transform all text to uppercase
26//! let doc = doc.transform_text(|text| text.to_uppercase());
27//!
28//! // Find all autolinks (in a document that has them)
29//! let autolinks = doc.find_all_inlines(|inline| {
30//! matches!(inline, Inline::Autolink(_))
31//! });
32//!
33//! // Complex pipeline
34//! let result = TransformPipeline::new()
35//! .transform_text(|s| s.trim().to_string())
36//! .transform_image_urls(|url| format!("https://cdn.example.com{}", url))
37//! .apply(doc);
38//! ```
39
40pub mod convenience;
41pub mod generic_transformer;
42pub mod pipeline;
43pub mod query;
44pub mod transformer;
45pub mod visitor;
46
47#[cfg(test)]
48mod tests;
49
50pub use convenience::*;
51pub use generic_transformer::*;
52pub use pipeline::*;
53pub use query::*;
54pub use transformer::*;
55pub use visitor::*;