Skip to content
Merged
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
6 changes: 3 additions & 3 deletions src/mistune/directives/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

__all__ = ["Image", "Figure"]

_num_re = re.compile(r"^\d+(?:\.\d*)?(?:px|ch|em|rem|ex|rex|vw|vh|%)?$")
_num_re = re.compile(r"^\d+(?:\.\d+)?(?:px|ch|em|rem|ex|rex|vw|vh|%)?$")
_allowed_aligns = ["top", "middle", "bottom", "left", "center", "right"]


Expand All @@ -29,9 +29,9 @@ def _parse_attrs(options: Dict[str, Any]) -> Dict[str, Any]:

height = options.get("height")
width = options.get("width")
if height and _num_re.match(height):
if height and _num_re.fullmatch(height):
attrs["height"] = height
if width and _num_re.match(width):
if width and _num_re.fullmatch(width):
attrs["width"] = width
if "target" in options:
attrs["target"] = escape_url(options["target"])
Expand Down
Loading