implement Render trait for html::Renderer

This commit is contained in:
kmaasrud 2023-02-10 09:46:18 +01:00 committed by Noah Hellman
parent 4743781cb9
commit d7f2c0a819
5 changed files with 28 additions and 44 deletions

View file

@ -1,10 +1,12 @@
use wasm_bindgen::prelude::*;
use jotdown::Render;
#[must_use]
#[wasm_bindgen]
pub fn jotdown_render(djot: &str) -> String {
let events = jotdown::Parser::new(djot);
let mut html = String::new();
jotdown::html::push(events, &mut html);
jotdown::html::Renderer.push(events, &mut html).unwrap();
html
}