1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use notedown_ast::utils::markdown::tokenize;
use crate::{Result, Config};
use notedown_ast::AST;
use crate::codegen::utils::view_function;


mod utils;
mod from;

pub trait ToYew {
    fn to_yew(&self) -> String;
}

pub fn markdown_str2ast(input: &str) -> AST {
    AST::from(tokenize(input))
}

pub fn markdown_codegen(file: &str, _out: &str, _cfg: &Config) -> Result<String> {
    let input = file;
    let out = markdown_str2ast(input).to_yew();
    Ok(view_function(&out))
}