panel
panel copied to clipboard
Markdown with LaTeX equations using underscores results in html italics `<em>` tags
I tried various combinations of using {} but couldn't get it to work as expected.
ALL software version info
Software Version Info
panel version 1.6.0
If you use markdown_it directly you will get the same result:
from pprint import pprint
from markdown_it import MarkdownIt
md = MarkdownIt()
a = md.render(
r"""
$$y_t = \text{intercept}_t + \text{slope}_t \cdot y_{t-1} + \text{steyx}_t \cdot \epsilon$$
"""
)
pprint(a)
('<p>$$y_t = \\text{intercept}_t + \\text{slope}<em>t \\cdot y</em>{t-1} + \\text{steyx}_t \\cdot \\epsilon$$</p>\n')
With markdown-it, the following configuration seems to solve your issue md.disable("emphasis"). In the pn.pane.Markdown, panel it is possible to pass some options to the MarkdownIt parser (with renderer_options keyword) but I did not find the possibility to disable the emphasis rules with it.
One workaround is to use
import panel as pn
from markdown_it import MarkdownIt
md = MarkdownIt()
md.disable("emphasis")
pn.extension("mathjax")
pn.pane.Markdown(
md.render(
r"""
$$y_t = \text{intercept}_t + \text{slope}_t \cdot y_{t-1} + \text{steyx}_t \cdot \epsilon$$
"""
)
).servable()