Skip to content

Commit

Permalink
markdown2html: Fix missing variables in IPythonRenderer.image
Browse files Browse the repository at this point in the history
  • Loading branch information
TiagodePAlves committed Aug 3, 2022
1 parent 0e4cd20 commit 0c8b823
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions nbconvert/filters/markdown_mistune.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,14 @@ def latex_environment(self, body, name):
def image(self, alt, url, title=None):
"""Rendering a image with title and text.
:param src: source link of the image.
:param text: alt text of the image.
:param alt: alt text of the image.
:param url: source link of the image.
:param title: title text of the image.
"""
attachment_prefix = "attachment:"

if src.startswith(attachment_prefix):
name = src[len(attachment_prefix) :]
if url.startswith(attachment_prefix):
name = url[len(attachment_prefix) :]

if name not in self.attachments:
raise InvalidNotebook(f"missing attachment: {name}")
Expand All @@ -242,13 +242,13 @@ def image(self, alt, url, title=None):
preferred_mime_type = list(attachment.keys())[0]
mime_type = preferred_mime_type
data = attachment[mime_type]
src = "data:" + mime_type + ";base64," + data
url = "data:" + mime_type + ";base64," + data

elif self.embed_images:
base64_url = self._src_to_base64(src)
base64_url = self._src_to_base64(url)

if base64_url is not None:
src = base64_url
url = base64_url

return super().image(alt, url, title)

Expand Down

0 comments on commit 0c8b823

Please sign in to comment.