This is a little thing I put together to let you write mdbooks where you can test the output of CLI code examples with trycmd.
I've provided an example .trycmd
, mdbook chapter page, and the mdbook plugin. Please note that the example .trycmd
has a bunch of odd stuff in it; I'm using this for a jj tutorial, and you need to do certain things to ensure reproducibility there.
I'm not making this into a github repo yet because there's a few caveats and i want you to understand them before you give it a go:
- this, like trycmd generally, executes whatever you tell it to in a tempdir. Don't try to colorize the output of
rm -rf / --no-preserve-root
and then get mad at me. - my code is bad. i put it together last night and this morning. no error handling, debug lines still in there, i didn't even run rustfmt or clippy.
- unlike
{#include
in rustdoc, the syntax highlighting can add lines, so the lines don't correspond to the.trycmd
directly. It'll take some trial and error to get them right. - other c