1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2024-12-15 14:27:50 +02:00
comprehensive-rust/mdbook-exerciser/README.md
Martin Geisler aaca44f62b
Format files with dprint (#711)
The dprint formatter is a flexible system which will use sandboxed
WebAssembly formatters to format our code (mostly: it calls out to
`rustfmt` for Rust code).

A particularly interesting feature is that dprint can format Rust code
blocks in the Markdown files. However, before we turn that on, we need
to have a way to normalize the Markdown text as it is extracted[1].
That is so that the word put into the translations is kept after the
reformatting.

[1]: https://github.com/google/mdbook-i18n-helpers/issues/19
2023-05-30 17:04:19 +02:00

28 lines
592 B
Markdown

# exerciser
This is an mdBook renderer to generate templates for exercises from the Markdown
source. Given a Markdown file `example.md` with one or more sections like:
````markdown
<!-- File src/main.rs -->
```rust,compile_fail
{{#include example/src/main.rs:main}}
fn some_more_code() {
// TODO: Write some Rust code here.
}
```
````
and mdbook configuration in `book.toml` like:
```toml
[output.exerciser]
output-directory = "comprehensive-rust-exercises"
```
It will create a file
`book/exerciser/comprehensive-rust-exercises/example/src/main.rs` with the
appropriate contents.