You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 12, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Jul 12, 2026. It is now read-only.
It should be trivial to configure different output renderers (HTML, RTF, ODT, LaTeX, etc.), and to create new ones (like Typst). I'm a bit uncertain on the ideal design ATM, however.
pluggable output renderers, starting with basic string, and maybe Djot integration #86
Here's how one uses jotdown, which has a Render trait to offer configurable output.
use jotdown::Render;let djot_input = "hello *world*!";let events = jotdown::Parser::new(djot_input);letmut html = String::new();
jotdown::html::Renderer::default().push(events,&mut html);assert_eq!(html,"<p>hello <strong>world</strong>!</p>\n");
While that's an event-based processor (hence the push method), and this isn't, here's how they define that trait:
pubtraitRender{/// Push owned [`Event`]s to a unicode-accepting buffer or stream.fnpush<'s,I,W>(&self,events:I,out:W) -> fmt::ResultwhereI:Iterator<Item = Event<'s>>,W: fmt::Write;/// Write owned [`Event`]s to a byte sink, encoded as UTF-8.////// NOTE: This performs many small writes, so IO writes should be buffered with e.g./// [`std::io::BufWriter`].fnwrite<'s,I,W>(&self,events:I,out:W) -> io::Result<()>whereI:Iterator<Item = Event<'s>>,W: io::Write,{letmut out = WriteAdapter{inner: out,error:Ok(()),};self.push(events,&mut out).map_err(|_| match out.error{Err(e) => e,
_ => io::Error::new(io::ErrorKind::Other,"formatter error"),})}
Activity
[-]Renderer design[/-][+]Pluggable Renderer design[/+]feat(proc): add refs_to_string placeholder
feat(proc): add refs_to_string placeholder
feat(proc): add refs_to_string placeholder
feat(proc): add refs_to_string placeholder
feat(proc): add refs_to_string placeholder