mdbook-snips

A mdbook preprocessor to add // --snip-- (or similar) before all "blocks" of hidden lines in rust blocks in a mdbook, making it very clear that there is some hidden code there.

(mdbook calls them boring lines).

Example:

Before: ```rust

fn f();

# fn g();

fn main() {

f();

g();

} ```

After: ```rust // --snip--

fn f();

fn g();

fn main() { // --snip--

f();

g();

} ```

Usage:

bash cargo install mdbook-snips

Then in the book.toml of your book:

toml [preprocessors.mdbook-snips] command = "mdbook-snips"

Default configuration: ```toml

book.toml

[preprocessors.mdbook-snips] command = "mdbook-snips" forimports = true forendofblock = false snip_text = "// --snip--" ```

\rust fn main() {

}

fn f() {}

``` ```

With for_end_of_block=true, it ends up as:

\rust fn main() {

}

// --snip--

fn f() {}

``` ```

But with for_end_of_block=false, it doesn't change: \rust fn main() {

}

fn f() {}

``` ```

For example, you can use a block comment: snip_text="/* --snip-- */"

Which, for:

```

fn f() {}

fn main() {} ```

Will give you:

``` /* --snip-- */

fn f() {}

fn main() {} ```

License

mdbook-snips is distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See the LICENSE-APACHE and LICENSE-MIT files in this repository for more information.