Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def image(self, src, title, text):
contents_manager = self.options['contents_manager']
if contents_manager.file_exists(src):
content = contents_manager.get(src, format='base64')
data = content['content'].replace('\n', '') # remove the newline
mime_type, encoding = mimetypes.guess_type(src)
src = 'data:{mime_type};base64,{data}'.format(mime_type=mime_type, data=data)
return super(VoilaMarkdownRenderer, self).image(src, title, text)