-
Notifications
You must be signed in to change notification settings - Fork 18
Description
Hello, thank you for the jotdown library!
I'd like to add a new Render implementation that outputs the events back to djot format.
My motivation is I've been using jotdown as part of a simple static site generator. As part of the generator, I have a couple passes which modify the content of each djot document. For example one pass will try to find a starting raw block like:
```{=json}
{
"draft": true
}
```
And read and remove it to be used as frontmatter (since djot hasn't standardized on frontmatter yet [I think]). Right now I use the .into_offset_iter() function to find the offset of the "frontmatter" block and remove it from the original string.
The problem comes up when I'd like to write more complex transformations, like replacing symbols or rewriting links. I'd like to render the modified events back to a djot string and the re-parse if needed.
I realize an alternative would be to store the modified events in a Vec or something and modify that array before the final rendering to HTML. Let me know what your thoughts are! I can also maintain this outside of the jotdown crate to start.
Thanks again,
Declan