File tree Expand file tree Collapse file tree 3 files changed +55
-3
lines changed
Expand file tree Collapse file tree 3 files changed +55
-3
lines changed Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+
3+ from __future__ import annotations
4+
5+ import subprocess
6+ import sys
7+ from pathlib import Path
8+
9+ try :
10+ from html2image import Html2Image # type: ignore[import]
11+ except ImportError :
12+ sys .exit (
13+ """
14+ html2image not found. Ensure you have Chrome (on Mac/Windows) or
15+ Chromium (on Linux) installed, and then do:
16+ pip install html2image
17+ """
18+ )
19+
20+
21+ def main ():
22+ subprocess .run (["mkdocs" , "build" ])
23+
24+ hti = Html2Image (custom_flags = ["--force-device-scale-factor=2" ])
25+
26+ html_str = Path ("docs/diagram.md" ).read_text ()
27+ css_tags = f"""
28+ <style>{ Path ("site/css/theme.css" ).read_text ()} </style>
29+ <style>{ Path ("site/css/theme_extra.css" ).read_text ()} </style>
30+ <style>{ Path ("site/extra.css" ).read_text ()} </style>
31+ <style>
32+ body {{
33+ background: white;
34+ }}
35+ </style>
36+ """
37+ html_str = css_tags + html_str
38+
39+ [screenshot , * _ ] = hti .screenshot (
40+ html_str = html_str ,
41+ size = (830 , 405 ),
42+ )
43+
44+ dest_path = Path ("docs/data/how-it-works.png" )
45+ if dest_path .exists ():
46+ dest_path .unlink ()
47+
48+ Path (screenshot ).rename (dest_path )
49+
50+
51+ if __name__ == "__main__" :
52+ main ()
Original file line number Diff line number Diff line change 2929 </div>
3030 <div class="grid-column-label"
3131 style="grid-row: 2 / span 1;
32- grid-column: 8 / -3;
32+ grid-column: 9 / -3;
3333 margin-bottom: 0.5em;">
3434 <div class="label">If tests are configured</div>
3535 </div>
382382 }
383383 .grid-column-label .label {
384384 background : #fcfcfc ;
385- padding : 0 2 em ;
385+ padding : 0 1 em ;
386386 position : relative ;
387387 }
388388 .grid-row-label {
420420 grid-column : 3 / -2 ;
421421 }
422422 .grid-outline.testVenv {
423- grid-column : 8 / span 4 ;
423+ grid-column : 9 / span 3 ;
424424 }
425425 .grid-outline .outline {
426426 position : absolute ;
You can’t perform that action at this time.
0 commit comments