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 gemoji;
8    pub(crate) mod gemoji_table;
9    pub(crate) mod slug;
10    pub(crate) mod slug_table;
11    pub(crate) mod url;
12}
13mod models {
14    pub(crate) mod arena;
15    pub(crate) mod data;
16    pub(crate) mod error;
17    pub(crate) mod file;
18    pub(crate) mod hast;
19    pub(crate) mod lines;
20    pub(crate) mod location;
21    pub(crate) mod mdast;
22    pub(crate) mod mdx;
23    pub(crate) mod nlcst;
24    pub(crate) mod position;
25    pub(crate) mod smartypants;
26    pub(crate) mod tree;
27}
28#[cfg(feature = "json")]
29mod actions {
30    pub(crate) mod hast {
31        pub(crate) mod deserialize;
32        pub(crate) mod serialize;
33    }
34    pub(crate) mod mdast {
35        pub(crate) mod deserialize;
36        pub(crate) mod serialize;
37    }
38    pub(crate) mod mdx {
39        pub(crate) mod deserialize;
40        pub(crate) mod serialize;
41    }
42    pub(crate) mod nlcst {
43        pub(crate) mod deserialize;
44        pub(crate) mod serialize;
45    }
46    pub(crate) mod position {
47        pub(crate) mod deserialize;
48        pub(crate) mod serialize;
49    }
50}
51
52/// The mdast nodes: Markdown's syntax tree.
53pub mod mdast {
54    #[cfg(feature = "json")]
55    pub use crate::actions::mdast::deserialize::deserialize_mdast;
56    #[cfg(feature = "json")]
57    pub use crate::actions::mdast::serialize::serialize_mdast;
58    pub use crate::models::mdast::*;
59    pub use crate::models::mdx::*;
60}
61
62/// The hast nodes: HTML's syntax tree.
63pub mod hast {
64    #[cfg(feature = "json")]
65    pub use crate::actions::hast::deserialize::deserialize_hast;
66    #[cfg(feature = "json")]
67    pub use crate::actions::hast::serialize::serialize_hast;
68    pub use crate::models::hast::*;
69    pub use crate::models::mdx::*;
70}
71
72/// The nlcst nodes: natural language's syntax tree.
73pub mod nlcst {
74    #[cfg(feature = "json")]
75    pub use crate::actions::nlcst::deserialize::deserialize_nlcst;
76    #[cfg(feature = "json")]
77    pub use crate::actions::nlcst::serialize::serialize_nlcst;
78    pub use crate::models::nlcst::*;
79}
80
81// helpers
82pub use helpers::gemoji::{find_gemoji_shortcodes, read_gemoji_label};
83pub use helpers::slug::{Slugger, create_slug};
84pub use helpers::url::{ResolvedUrl, prefix_base, resolve_url};
85
86// models
87pub use models::arena::ArenaVec;
88pub use models::data::Data;
89pub use models::error::Error;
90pub use models::file::{File, Message};
91pub use models::lines::Lines;
92pub use models::location::Location;
93pub use models::position::{Point, Position, UnistPoint, UnistPosition};
94pub use models::smartypants::{
95    Backticks, Dashes, Ellipses, QuoteCharacters, Typography, read_switch,
96};
97pub use models::tree::{Tree, TreeKind};
98pub use plugin::{
99    Attach, Compiler, HtmlTarget, HtmlWriter, Job, NaturalLanguageParser,
100    NaturalLanguageParserSlot, Parser, Plugin, ScriptError, ScriptExpression,
101    ScriptParser, ScriptParserSlot, ScriptStatement, Slots, Step, Transform, Typographer,
102    TypographerSlot,
103};
104
105/// The arena every node of one document is allocated in.
106pub use bumpalo::Bump as Allocator;
107/// A string allocated in a document's arena, while it is being built.
108pub type ArenaString<'a> = bumpalo::collections::String<'a>;