1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//! # tiptap-rusty-parser
//!
//! Fast, schema-agnostic parser and manipulator for Tiptap / ProseMirror
//! `JSONContent` documents.
//!
//! - **Parse / serialize** via [`Document`] (faithful roundtrip, unknown fields
//! preserved).
//! - **Query** with predicate closures: [`Node::find`], [`Node::find_all`],
//! [`Node::walk`], [`Node::descendants`].
//! - **Select** by type/mark/attr: [`Node::by_type`], [`Node::by_mark`],
//! [`Node::by_attr`].
//! - **Address** by index path: [`Node::node_at`], [`Node::path_to`]; or by flat
//! ProseMirror integer position: [`Node::resolve`], [`Node::pos_before`], [`ResolvedPos`].
//! - **Mutate** in place: marks, attrs, children, text, and bulk
//! [`Node::replace_all`].
//! - **Normalize** to a canonical form (merge adjacent text, drop empties):
//! [`Node::normalize`], [`NormalizeOptions`].
//! - **Range-edit** a block's inline content (insert/delete/replace text, mark
//! ranges): [`Node::insert_text`], [`Node::add_mark_range`], [`Position`], [`Range`].
//! - **Restructure** the block tree (split/join/wrap/lift/retype):
//! [`Node::split_block`], [`Node::join_blocks`], [`Node::wrap`], [`Node::lift`], [`BlockRange`].
//! - **Diff / apply / invert** structural change lists between two trees
//! (undo-capable): [`Node::diff`], [`apply`], [`invert`].
//! - **Edit by flat position**: apply a batch of [`PosEdit`]s addressed by
//! ProseMirror integer positions, recovering an invertible patch:
//! [`Node::apply_pos_edits`], [`PosContent`].
//! - **Transact**: mutate in place while recording a replayable/invertible
//! change log: [`Node::transform`], [`Transform`].
//! - **Operate on change lists**: [`compose`], [`compact`], and carry a path
//! through edits with [`map_path`].
//! - **Extract** text: [`Node::text_content`], [`Node::word_count`].
//! - **Validate** (opt-in) against a schema, incl. ProseMirror content
//! expressions: [`Node::validate`], [`Schema`], [`ContentExpr`].
//! - **Render** to HTML: [`Node::to_html`], [`HtmlOptions`].
//! - **Build** nodes ergonomically: [`Node::element`], [`Node::text`], [`doc`].
//!
//! ```
//! use tiptap_rusty_parser::{Document, Mark, Node};
//!
//! let mut doc = Document::from_json_str(
//! r#"{"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"hi"}]}]}"#,
//! )
//! .unwrap();
//!
//! // Bold every text node.
//! doc.replace_all(
//! |n| n.node_type.as_deref() == Some("text"),
//! |n| { n.add_mark(Mark::new("bold")); },
//! );
//!
//! // Append a new paragraph.
//! doc.push_child(Node::element("paragraph").with_text("bye"));
//!
//! assert_eq!(doc.find_all(|n| n.node_type.as_deref() == Some("paragraph")).len(), 2);
//! ```
pub use ;
pub use doc;
pub use ;
pub use ;
pub use ;
pub use Document;
pub use ;
pub use ;
pub use ;
pub use NormalizeOptions;
pub use ;
pub use ;
pub use Descendants;
pub use ;
pub use ;
pub use ;
pub use Transform;