MCPcopy Create free account
hub / github.com/ipython/ipython / latex_to_html

Function latex_to_html

IPython/lib/latextools.py:206–218  ·  view source on GitHub ↗

Render LaTeX to HTML with embedded PNG data using data URIs. Parameters ---------- s : str The raw string containing valid inline LateX. alt : str The alt text to use for the HTML.

(s, alt='image')

Source from the content-addressed store, hash-verified

204_data_uri_template_png = u"""<img src="data:image/png;base64,%s" alt=%s />"""
205
206def latex_to_html(s, alt='image'):
207 """Render LaTeX to HTML with embedded PNG data using data URIs.
208
209 Parameters
210 ----------
211 s : str
212 The raw string containing valid inline LateX.
213 alt : str
214 The alt text to use for the HTML.
215 """
216 base64_data = latex_to_png(s, encode=True).decode('ascii')
217 if base64_data:
218 return _data_uri_template_png % (base64_data, alt)
219
220

Callers

nothing calls this directly

Calls 1

latex_to_pngFunction · 0.85

Tested by

no test coverage detected