aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/mdx_expression_text.rs
blob: 8d061ebec33b6892c12bf67e65835fcbed9f26bf (plain) (blame)
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
//! To do.

use crate::event::Name;
use crate::state::{Name as StateName, State};
use crate::tokenizer::Tokenizer;

/// Start of MDX: expression (text).
///
/// ```markdown
/// > | a {Math.PI} c
///       ^
/// ```
pub fn start(tokenizer: &mut Tokenizer) -> State {
    if Some(b'{') == tokenizer.current
        && tokenizer.parse_state.options.constructs.mdx_expression_text
    {
        tokenizer.tokenize_state.token_1 = Name::MdxTextExpression;
        tokenizer.attempt(State::Next(StateName::MdxExpressionTextAfter), State::Nok);
        State::Retry(StateName::MdxExpressionStart)
    } else {
        State::Nok
    }
}

/// After an MDX expression (text) tag.
///
/// ```markdown
/// > | a {Math.PI} c
///                ^
/// ```
pub fn after(tokenizer: &mut Tokenizer) -> State {
    tokenizer.tokenize_state.token_1 = Name::Data;
    State::Ok
}