Skip to main content

textlane_core/
lib.rs

1//! Textlane's core: the unist conventions and the mdast, hast and nlcst nodes built on them, the
2//! file a pipeline reads and reports diagnostics against, and the plugin contract every crate
3//! shares.
4
5mod plugin;
6mod helpers {
7    pub(crate) mod slug;
8    pub(crate) mod slug_table;
9}
10mod models {
11    pub(crate) mod arena;
12    pub(crate) mod data;
13    pub(crate) mod error;
14    pub(crate) mod file;
15    pub(crate) mod hast;
16    pub(crate) mod lines;
17    pub(crate) mod location;
18    pub(crate) mod mdast;
19    pub(crate) mod mdx;
20    pub(crate) mod nlcst;
21    pub(crate) mod position;
22    pub(crate) mod tree;
23}
24#[cfg(feature = "json")]
25mod actions {
26    pub(crate) mod hast {
27        pub(crate) mod deserialize;
28        pub(crate) mod serialize;
29    }
30    pub(crate) mod mdast {
31        pub(crate) mod deserialize;
32        pub(crate) mod serialize;
33    }
34    pub(crate) mod mdx {
35        pub(crate) mod deserialize;
36        pub(crate) mod serialize;
37    }
38    pub(crate) mod nlcst {
39        pub(crate) mod deserialize;
40        pub(crate) mod serialize;
41    }
42    pub(crate) mod position {
43        pub(crate) mod deserialize;
44        pub(crate) mod serialize;
45    }
46}
47
48/// The mdast nodes: Markdown's syntax tree.
49pub mod mdast {
50    #[cfg(feature = "json")]
51    pub use crate::actions::mdast::deserialize::deserialize_mdast;
52    #[cfg(feature = "json")]
53    pub use crate::actions::mdast::serialize::serialize_mdast;
54    pub use crate::models::mdast::*;
55    pub use crate::models::mdx::*;
56}
57
58/// The hast nodes: HTML's syntax tree.
59pub mod hast {
60    #[cfg(feature = "json")]
61    pub use crate::actions::hast::deserialize::deserialize_hast;
62    #[cfg(feature = "json")]
63    pub use crate::actions::hast::serialize::serialize_hast;
64    pub use crate::models::hast::*;
65    pub use crate::models::mdx::*;
66}
67
68/// The nlcst nodes: natural language's syntax tree.
69pub mod nlcst {
70    #[cfg(feature = "json")]
71    pub use crate::actions::nlcst::deserialize::deserialize_nlcst;
72    #[cfg(feature = "json")]
73    pub use crate::actions::nlcst::serialize::serialize_nlcst;
74    pub use crate::models::nlcst::*;
75}
76
77// helpers
78pub use helpers::slug::{Slugger, create_slug};
79
80// models
81pub use models::arena::ArenaVec;
82pub use models::data::Data;
83pub use models::error::Error;
84pub use models::file::{File, Message};
85pub use models::lines::Lines;
86pub use models::location::Location;
87pub use models::position::{Point, Position, UnistPoint, UnistPosition};
88pub use models::tree::{Tree, TreeKind};
89pub use plugin::{
90    Attach, Compiler, HtmlTarget, HtmlWriter, Job, NaturalLanguageParser,
91    NaturalLanguageParserSlot, Parser, Plugin, ScriptError, ScriptExpression,
92    ScriptParser, ScriptParserSlot, ScriptStatement, Slots, Step, Transform,
93};
94
95/// The arena every node of one document is allocated in.
96pub use bumpalo::Bump as Allocator;
97/// A string allocated in a document's arena, while it is being built.
98pub type ArenaString<'a> = bumpalo::collections::String<'a>;