-
Notifications
You must be signed in to change notification settings - Fork 47
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
DOP-4207: pre determine image dimensions in parser #547
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.
Nice! I've wanted this to happen for a while, so it's nice to see this done!
@@ -159,6 +159,10 @@ def __call__( | |||
try: | |||
checksum = self.asset.get_checksum() | |||
options["checksum"] = checksum | |||
dimensions = self.asset.dimensions | |||
if dimensions is not None: | |||
options["width"] = str(dimensions[0]) |
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.
@i80and seems like this will overwrite some input user data (ie. width option). validating this is None before overwriting in a follow up PR
Goal: Add width and height properties to images and figures such that the AST contains these dimensions in order for snooty to lazy load images in the same dimension.
I added this package as a lightweight image size getter, but open to suggestion such as PIL.
Package has been installed via CLI command
poetry add [email protected]
which updated pyproject.toml and poetry.lock subsequently.Example of staged changes with frontend branch
Note:
diagnostics
property to static_asset so that any errors while getting image dimensions will appended to the parser's diagnostics. ex:Question:
width
andscale
options of image directive? seems like from this example of image directive usage, it is a existing bug to not respect this width (HTML output)