Allow style attribute on img tags to override CSS width

- Added style attribute to bleach allowlist for img tags
- Fixes issue where CSS img { width: 100%; } overrides width attribute
- Inline style='width:360px;' has higher specificity than stylesheet
- Now supports both width='360' and style='width:360px;' formats
This commit is contained in:
Russell Ballestrini 2025-07-28 10:53:38 -04:00
parent cfe63b2f92
commit 0c8e1b4f89

View file

@ -56,6 +56,7 @@ def default_cleaner(tag_acl=None):
attrs = markdown_attrs
attrs["img"].append("width")
attrs["img"].append("style")
attrs["span"] = ["class"]
# Allow both whitelist and blacklist tag_name/attr/attr_value