@@ -188,7 +188,8 @@ def handleMatch(self, m):
188188
189189class MathJaxExtension (markdown .Extension ):
190190 def extendMarkdown (self , md , md_globals = None ):
191- # Needs to come before escape matching because \ is pretty important in LaTeX
191+ # Needs to come before escape matching because \ is
192+ # pretty important in LaTeX
192193 md .inlinePatterns .add ('mathjax' , MathJaxPattern (), '<escape' )
193194
194195
@@ -217,7 +218,10 @@ def _render_markdown(self,
217218
218219 # proxy posts are assumed to be embeddable links
219220 if PROXY in self .kp .headers :
220- return None , '<a href="{0}">Linked Post</a>\n <iframe width=100% height=1000 src="{0}"></iframe>' .format (self .kp .headers ['proxy' ].strip ())
221+ proxy = self .kp .headers [PROXY ].strip ()
222+ return None , (f'<a href="{ proxy } ">Linked Post</a>\n '
223+ f'<iframe width=100% height=1000 '
224+ f'src="{ proxy } "></iframe>' )
221225
222226 html = ''
223227 if not skip_headers :
@@ -256,7 +260,8 @@ def urlmapper_proxy(name, match):
256260 return match .group (0 ).replace (match .group ('url' ), new_url )
257261 return None
258262
259- return SubstitutionMapper (patterns = patterns , mappers = [urlmapper_proxy ]).apply (html )
263+ return SubstitutionMapper (patterns = patterns ,
264+ mappers = [urlmapper_proxy ]).apply (html )
260265
261266 # Utility methods
262267 def render_headers (self ):
@@ -287,5 +292,6 @@ def base64_encode_image_mapper(self, tag, url):
287292 image_data = base64 .b64encode (self .kp_images [url ])
288293 image_mimetype = mimetypes .guess_type (url )[0 ]
289294 if image_mimetype is not None :
290- return f'data:{ image_mimetype } ;base64, ' + image_data .decode (UTF8 )
295+ return f'data:{ image_mimetype } ;base64, ' + \
296+ image_data .decode (UTF8 )
291297 return None
0 commit comments