Create book from markdown files. Like Gitbook but implemented in Rust
Go to file
Stephen Checkoway 32687e64fe Color test output and shorten chapter paths
Currently, the output from `rustdoc --test` is not colored because
`rustdoc`'s stdout is not a tty. The output of a failed `rustdoc` run is
sent to `mdbook`'s stderr via the `error!()` macro. This commit checks
if stderr is a tty using the standard `.is_terminal()` and if so, passes
`--color always` to `rustdoc`.

The test output from `rustdoc` includes the full path that `rustdoc` was
called with. This obscures the path of the file with the error. E.g.,
```
---- /var/folders/9v/90bm7kb10fx3_bprxltb3t1r0000gn/T/mdbook-tnGJxp/lab0/index.md - Lab_0__Getting_Started (line 3) stdout ----
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `code`
 --> /var/folders/9v/90bm7kb10fx3_bprxltb3t1r0000gn/T/mdbook-tnGJxp/lab0/index.md:4:6
  |
3 | this code has a bug
  |      ^^^^ expected one of 8 possible tokens

error: aborting due to previous error
```

This commit runs `rustdoc` in the temp directory and replaces any
relative library paths with absolute library paths. This leads to
simpler error messages. The one above becomes
```
---- lab0/index.md - Lab_0__Getting_Started (line 3) stdout ----
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `code`
 --> lab0/index.md:4:6
  |
3 | this code has a bug
  |      ^^^^ expected one of 8 possible tokens

error: aborting due to previous error
```
(with colors, of course).
2023-12-06 12:09:07 -05:00
.github Update msrv to 1.70 2023-11-29 14:36:39 -08:00
ci Rewrite asset deploy. 2023-07-16 17:16:15 -07:00
examples upgrade clap to 4.0 2022-12-14 17:11:08 -08:00
guide Update to 0.4.36 2023-11-29 14:50:26 -08:00
src Color test output and shorten chapter paths 2023-12-06 12:09:07 -05:00
test_book Add Nim to default languages 2023-11-08 15:34:35 +01:00
tests Fix search for custom heading attributes 2023-05-28 12:03:03 -07:00
.gitattributes Explicitly mark fonts and images files as binary (#951) 2019-06-11 21:44:15 +02:00
.gitignore Setup basic structure for test book 2021-10-04 13:14:49 +05:30
CHANGELOG.md Update to 0.4.36 2023-11-29 14:50:26 -08:00
CODE_OF_CONDUCT.md add explicit code of conduct, copying other rust-lang repos 2021-07-26 11:52:24 -07:00
CONTRIBUTING.md Add Nim to default languages 2023-11-08 15:34:35 +01:00
Cargo.lock Update to 0.4.36 2023-11-29 14:50:26 -08:00
Cargo.toml Update to 0.4.36 2023-11-29 14:50:26 -08:00
LICENSE Create LICENSE 2015-07-29 01:11:30 +02:00
README.md Update documentation 2021-12-19 20:26:37 -08:00
release.toml Metadata for cargo-release should be in release.toml (#722) 2018-07-09 18:36:55 +08:00
triagebot.toml Add issue templates and update contributor docs 2023-01-16 09:22:54 -08:00

README.md

mdBook

Build Status crates.io LICENSE

mdBook is a utility to create modern online books from Markdown files.

Check out the User Guide for a list of features and installation and usage information. The User Guide also serves as a demonstration to showcase what a book looks like.

If you are interested in contributing to the development of mdBook, check out the Contribution Guide.

License

All the code in this repository is released under the Mozilla Public License v2.0, for more information take a look at the LICENSE file.