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')
| 204 | _data_uri_template_png = u"""<img src="data:image/png;base64,%s" alt=%s />""" |
| 205 | |
| 206 | def 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 |
nothing calls this directly
no test coverage detected