diff --git a/src/djot.rs b/src/djot.rs index d5a4a31..2e49d4c 100644 --- a/src/djot.rs +++ b/src/djot.rs @@ -111,7 +111,7 @@ impl Context { } } -pub fn djot_to_ir<'s>(mut djot: impl Iterator>) -> impl Iterator> { +fn djot_to_ir<'s>(mut djot: impl Iterator>) -> impl Iterator> { let mut ctx = Context::new(); // to be replaced by `gen`-blocks @@ -629,6 +629,10 @@ pub fn djot_to_ir<'s>(mut djot: impl Iterator>) -> impl Iterato .into_iter() } +pub fn parse<'s>(input: &'s str) -> impl Iterator> { + djot_to_ir(jotdown::Parser::new(input)) +} + #[cfg(test)] mod test { use std::collections::HashMap; diff --git a/src/main.rs b/src/main.rs index 3cab45f..7c27693 100644 --- a/src/main.rs +++ b/src/main.rs @@ -152,7 +152,7 @@ fn build(ctx: &Ctx, path: &Path, renderer: &render::Renderer) -> anyhow::Result< let mut parsed: Vec>> = content .par_iter() - .map(|content| djot::djot_to_ir(jotdown::Parser::new(content)).collect()) + .map(|content| djot::parse(content).collect()) .collect(); // Parse entry front matter, consuming the front matter events from `parsed`