1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2024-12-03 19:16:38 +02:00
comprehensive-rust/mdbook-slide-evaluator
dependabot[bot] c85816a01f
cargo: bump the patch group across 1 directory with 12 updates (#2489)
Bumps the patch group with 12 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [anyhow](https://github.com/dtolnay/anyhow) | `1.0.91` | `1.0.93` |
| [clap](https://github.com/clap-rs/clap) | `4.5.20` | `4.5.21` |
| [mdbook](https://github.com/rust-lang/mdBook) | `0.4.40` | `0.4.43` |
| [serde](https://github.com/serde-rs/serde) | `1.0.214` | `1.0.215` |
| [serde_json](https://github.com/serde-rs/json) | `1.0.132` | `1.0.133`
|
| [csv](https://github.com/BurntSushi/rust-csv) | `1.3.0` | `1.3.1` |
| [tokio](https://github.com/tokio-rs/tokio) | `1.41.0` | `1.41.1` |
| [url](https://github.com/servo/rust-url) | `2.5.2` | `2.5.4` |
| [mockall](https://github.com/asomers/mockall) | `0.13.0` | `0.13.1` |
| [zerocopy](https://github.com/google/zerocopy) | `0.8.8` | `0.8.11` |
| [cxx](https://github.com/dtolnay/cxx) | `1.0.129` | `1.0.133` |
| [cxx-build](https://github.com/dtolnay/cxx) | `1.0.129` | `1.0.133` |

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-01 21:05:18 +00:00
..
src Add mdbook-slide-evaluator (#2258) 2024-08-21 07:18:07 +00:00
Cargo.toml cargo: bump the patch group across 1 directory with 12 updates (#2489) 2024-12-01 21:05:18 +00:00
README.md Add mdbook-slide-evaluator (#2258) 2024-08-21 07:18:07 +00:00

mdbook-slide-evaluator allows you to evaluate the rendered slides. This way one can find if there is too much content on the slides and if sorted by size one can focus on the worst violations first.

How to run

Start a WebDriver compatible browser

Alternative: Docker

Start a selenium docker container and mount the book folder into the container at /book/:

$ docker run -d -p 4444:4444 -p 7900:7900 --volume /path/to/my/workspace/comprehensive-rust/book:/book --shm-size="2g" selenium/standalone-chromium:latest

As the tool is running with a different base directory, you can use a relative directory e.g., ../book/:

$ cargo run -- ../book

Alternative: Local WebDriver browser with webdriver-manager

Use webdriver-manager to install a e.g., a chromedriver onto your system with:

$ pip install selenium webdriver-manager
$ python3
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager

driver = webdriver.Chrome(service=Service(ChromeDriverManager().install(), port=4444))
# end the session when you are done.

You can provide the absolute path here as the browser has the same view on the filesystem:

$ cargo run -- /path/to/my/workspace/comprehensive-rust/book

Run mdbook-slide-size

If a screenshot directory is provided, the tool can also create screenshots to evaluate this manually. The tool always recursively grabs all *.html files from the given directory and processes it.

cargo run -- --screenshot-dir screenshots ../book/html/

Roadmap

To avoid a docker mount, try to build a data uri from the given slide. This has the challenge that this contains links to local stylesheets that have to be included. css_inline can be used for that and this already works (kind of). If someone wants to take a stab at this, feel free to contact the author.