Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dcc.Markdown(mathjax=True, dangerously_allow_html=True) combination #2003

Closed
anders-kiaer opened this issue Mar 30, 2022 · 1 comment
Closed

Comments

@anders-kiaer
Copy link
Contributor

anders-kiaer commented Mar 30, 2022

Thanks for the MathJax support in the latest Dash version 🎉 I've been trying it out today, and there is small detail that (if possible to solve) would make it easier to integrate in our application.

We currently use dcc.Markdown(content, dangerously_allow_html=True) where user content has been through bleach and includes some allowed content pre-processed by us (e.g. <img> with text caption / centering support etc, <details>/<summary> parts).

It looks like dangerously_allow_html=True + mathjax=True works in some cases, and in some cases not. Given

from dash import Dash, dcc

app = Dash(__name__)

CONTENT = ...

app.layout = dcc.Markdown(CONTENT, dangerously_allow_html=True, mathjax=True)

app.run_server()

these are some experiments:

CONTENT
Math rendered
<details>
    <summary>Topic</summary>
    Some details
</details>
$E = mc^2$
✔️
<p>Some paragraph</p>
$E = mc^2$
✔️
<p>Some paragraph</p>
$E = mc^2$
<p>Some paragraph</p> $E = mc^2$
<p>Some paragraph with $E = mc^2$ inline math</p>

Easy fix to support the given combination of arguments to dcc.Markdown? If not we could reconsider our use case of supporting allowed html tags 🙂

@alexcjohnson
Copy link
Collaborator

Fixed by @nickmelnikov82 in #2043 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants