Skip to content

LaTeX not rendering in cell text/html encoded outputs when embedded inside html #203725

@xinyi-joffre

Description

@xinyi-joffre

image

Environment data

  • VS Code version: 1.74.3
  • Jupyter Extension version (available under the Extensions sidebar): v2022.11.1003412109
  • Python Extension version (available under the Extensions sidebar): v2022.20.2

Expected behaviour

Expect that LaTeX in table is rendered.

The outputs render correctly in Jupyter and JupyterLab, but looks like html outputs are not going through MathJax typeset to render math if inside html.

Actual behaviour

LaTeX in table is raw text and not showing as rendered math.

Steps to reproduce:

  1. Open a python kernel
  2. Run this cell:
%%html
<div>$\sqrt(2)$</div>
  1. Since math is nested inside of div html, instead of seeing √2 in LaTex, you will see plaintext $\sqrt(2)$

Possible fix

After running transform on text/html to react element, can MathJax.Typeset be called on the root element of the output display? That will match Jupyter/JupyterLab's behavior to have math supported more natively in many scenarios. This is currently making html math outputs from kernels like IQ# (Azure Quantum's kernel for Q# language) very hard to read without MathJax being rendered.

The markdown renderer doesn't work for many of these scenarios, since the markdown renderer doesn't treat html correctly in many cases, such as if it's tabbed, it treats it like a block quote, so just changing the presentation type doesn't work.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions