-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add mdbook-slide-evaluator #2258
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is pretty cool!
I'm actually not sure if this repository is the best choice for this tool or if should be in a different/separate repo |
…e reproducible results.
close the webclient session and return already available results
Errors previously have been ignored and next slide was evaluated
Hey @michael-kerscher, let me just say that this looks super cool! It's impressive that you can get this done with so little code 😄 Thanks a lot! I haven't had a change to try it out myself, but it seems the dependencies are just a Docker container with Selenium. That's cool and it should be something I could also run without Docker, right? Perhaps using python3-selenium from Debian? I'll eventually play around with this, but Docker is fine for GitHub CI. |
I think you need to install |
It takes a few steps for us to create new repositories in the |
You don't really need a docker container, yes. |
What still needs some work is some actual policy that is evaluated. E.g. defining a threshold for how many pixels the height can be |
To put some numbers here, the current full book with all pages that have a main element are evaluated in about 3 minutes when rendered with selenium/standalone-chromium:latest
|
This seems to be ready for the intended use case now. |
Thanks for the example in the README, I'll give it a go! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried this locally with the Python instructions and it's cool!
Let us merge this now so we have something to build on. Things to look at implementing later:
- A small integration test for this, something we can run in GitHub to protect against bit rot. It could be something which evaluates a single static HTML file.
- The GitHub integration which can be run on PRs to warn authors about too large pages. I think it would be useful if we could show the delta in size, something like "This PR increases the slide height by 20px". If we can do that, we can avoid annoying people when they fix typos in an already large slide.
I think it will be useful to ignore a `.venv` directory, in case people install the Python WebDriver tools into it.
I created a first implementation for the mdbook-slide-evaluator I described in #2234.
This is still not finished but I wanted to provide a chance to review the current state.
One has to run a webdriver compatible browser (e.g. selenium-chromium) so the slides can be rendered. The browser can access the file either via a file:// or http:// uri.
The tool grabs the configurable element from that page and evaluates the size of this element. Output can be stored in a csv file or at stdout and looks like this at the moment:
It is also capable of storing screenshots of the evaluated element to have a manual view.
Possible improvements: