rotext/
lib.rs

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
#![allow(incomplete_features)]
#![feature(generic_const_exprs)]

mod blend;
mod block;
mod common;
mod events;
mod inline;
mod types;

pub mod rendering;
pub mod utils;

#[cfg(test)]
pub(crate) mod test_suites;
#[cfg(test)]
pub(crate) mod test_support;

pub use events::{BlendEvent, BlockEvent, Event};
pub use rendering::{HtmlRenderer, NewHtmlRendererOptoins};
pub use types::{Error, Result};

use utils::stack::{Stack, VecStack};

pub fn parse(
    input: &[u8],
) -> blend::BlockEventStreamInlineSegmentMapper<
    block::Parser<VecStack<block::StackEntry>>,
    VecStack<inline::StackEntry>,
> {
    let block_parser = block::Parser::new(input);

    blend::BlockEventStreamInlineSegmentMapper::new(input, block_parser)
}

pub fn parse_with_stack<
    TBlockStack: Stack<block::StackEntry>,
    TInlineStack: Stack<inline::StackEntry>,
>(
    input: &[u8],
) -> blend::BlockEventStreamInlineSegmentMapper<block::Parser<TBlockStack>, TInlineStack> {
    let block_parser = block::Parser::new(input);

    blend::BlockEventStreamInlineSegmentMapper::new(input, block_parser)
}