Utilities

markdownx.utils.markdownify(content)[source]

Trans-compiles Markdown text to HTML.

Parameters:content (str) – Markdown text.
Returns:HTML encoded text.
Return type:str
markdownx.utils.scale_and_crop(image, size, crop=False, upscale=False, quality=None)[source]

Modifies raster graphic images to the specifications.

Parameters:
  • image (BytesIO) – Raster graphic image.
  • size (int) – New size.
  • crop (bool) – Perform cropping or not.
  • upscale (bool) – Whether or not to upscale the image.
  • quality (int) – Quality of the new image in DPI.
Returns:

Raster graphic image modified to the given specifications.

Return type:

BytesIO

markdownx.utils.xml_has_javascript(data)[source]

Checks XML for JavaScript. See “security” in customization for additional information.

Parameters:data (str, bytes) – Contents to be monitored for JavaScript injection.
Returns:True if data contains JavaScript tag(s), otherwise False.
Return type:bool