-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: switch to new chromium headless mode #117
base: main
Are you sure you want to change the base?
feat: switch to new chromium headless mode #117
Conversation
Revert debian->alpine change Add --headless=new
Fix svg regex
@@ -16,7 +16,7 @@ | |||
|
|||
# Process img tags, replacing base64 SVG images with PNGs | |||
def process_svg(html: str) -> str: | |||
pattern = re.compile(r'<img(?P<intermediate>[^>]+?src="data:)(?P<type>[^;>]+)?;base64,(?P<base64>[^"]+)?"') | |||
pattern = re.compile(r'<img(?P<intermediate>[^>]+?src="data:)(?P<type>[^;>]+)?;base64,\s?(?P<base64>[^">]+)?"') |
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.
why?
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.
When I updated this repository with the repo template, I adjusted the regex to take fewer steps
But I overlooked those two characters
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.
the old implementation was:
pattern = re.compile(r'<img(?P[^>]+?src="data:)(?P[^;>]?);base64,\s?(?P[^">]?)"')
|
@@ -156,7 +156,7 @@ def create_chromium_command(width: int, height: int, png_filepath: Path, svg_fil | |||
|
|||
command = [ | |||
chromium_executable, | |||
"--headless=old", | |||
"--headless=new", |
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.
changing headless mode to new
introduces the issue that bottom part of SVG is cut
Fix new headless bottom cut problem
Revert debian->alpine change
Add --headless=new
Proposed changes
Switch back to debian and use new headless mode
Checklist
Before creating a PR, run through this checklist and mark each as complete:
CONTRIBUTING
document