Open Nemo157 opened 7 years ago
Is this possible to generate with 'pure' markdown? And not just events?
Not that I'm aware of.
As that seems to be the use case number one I don't think it is a big issue.
However I would definitely note somewhere that invalid input might cause invalid output. I do agree though that it shouldn't silently drop errors.
What about adding a 'check' method?
I was thinking about something like that, but not sure how possible that is with the support for iterating the events just once. I guess pulldown_cmark::Event
would need to have impl Clone
added then a clone of the event stream could be checked. Other big downside is that no-one would probably even use it since it's not how maud
is really intended to be used.
Another alternative may be to have a log
feature that hooks into something like https://github.com/rust-lang-nursery/log since a lot of applications would probably be using it.
I'm not planning on doing anything for this right now, I need to take a look at rust's logging libraries for another project anyway so I'll post anything that looks relevant from that.
What about a lazy enum? If it succeeds you can replace itself with the computed value
At the moment with
maud
v0.11.0 if a consumer of this library passes its markdown through a filter generating an unexpected series of events thenmaud-pulldown-cmark
will exit early with anErr
response,maud
will just ignore the error and continue rendering the next part of the template.An example:
saved to
examples/invalid.rs
and run withcargo run --example invalid
gives:After the update to
maud
v0.12.0 in #8 the same example now gives:which is more valid, but still is silently dropping some of the input. Hopefully there is some way to report this sort of issue back to the user.