Skip to content
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

Fix error in docs diagram #1274

Merged
merged 2 commits into from
Sep 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions bin/update_how_it_works_image.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env python3

from __future__ import annotations

import subprocess
import sys
from pathlib import Path

try:
from html2image import Html2Image # type: ignore[import]
except ImportError:
sys.exit(
"""
html2image not found. Ensure you have Chrome (on Mac/Windows) or
Chromium (on Linux) installed, and then do:
pip install html2image
"""
)


def main():
subprocess.run(["mkdocs", "build"])

hti = Html2Image(custom_flags=["--force-device-scale-factor=2"])

html_str = Path("docs/diagram.md").read_text()
css_tags = f"""
<style>{Path("site/css/theme.css").read_text()}</style>
<style>{Path("site/css/theme_extra.css").read_text()}</style>
<style>{Path("site/extra.css").read_text()}</style>
<style>
body {{
background: white;
}}
</style>
"""
html_str = css_tags + html_str

[screenshot, *_] = hti.screenshot(
html_str=html_str,
size=(830, 405),
)

dest_path = Path("docs/data/how-it-works.png")
if dest_path.exists():
dest_path.unlink()

Path(screenshot).rename(dest_path)


if __name__ == "__main__":
main()
Binary file modified docs/data/how-it-works.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions docs/diagram.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</div>
<div class="grid-column-label"
style="grid-row: 2 / span 1;
grid-column: 8 / -3;
grid-column: 9 / -3;
margin-bottom: 0.5em;">
<div class="label">If tests are configured</div>
</div>
Expand Down Expand Up @@ -382,7 +382,7 @@
}
.grid-column-label .label {
background: #fcfcfc;
padding: 0 2em;
padding: 0 1em;
position: relative;
}
.grid-row-label {
Expand Down Expand Up @@ -420,7 +420,7 @@
grid-column: 3 / -2;
}
.grid-outline.testVenv {
grid-column: 8 / span 4;
grid-column: 9 / span 3;
}
.grid-outline .outline {
position: absolute;
Expand Down