Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

[BUG] Breaking change in Markdown between Dash 1.7 and 1.8 #746

@anders-kiaer

Description

@anders-kiaer

Describe your context

pip list | grep dash:

dash                                  1.8.0                          
dash-core-components                  1.7.0                          
dash-html-components                  1.0.2                          
dash-renderer                         1.2.3                          
dash-table                            4.6.0     

Describe the bug

On dash==1.7 the following works as expected:

import dash
import dash_core_components as dcc
import dash_html_components as html

app = dash.Dash()

app.layout = html.Div(
    children=[
        dcc.Markdown(
            """
<p>Some text above</p>
<img src="some_path.png">
<p>Some text below</p>
""",
            dangerously_allow_html=True,
        )
    ]
)

if __name__ == "__main__":
    app.run_server(debug=True)

When upgrading to dash==1.8 most/all of the Markdown content is not rendered.

After some debugging it turned out that going from dash==1.7 to dash==1.8, we need to have e.g. <img ... /> instead of <img ... > in the markdown. The closing slash is necessary only on dash==1.8, not dash==1.7.

Expected behavior

dash==1.8 accepting the same Markdown input as dash==1.7. Not using a closing / on img tags is also quite common, e.g. the examples on MDN web docs do not have a closing /.

Using the common Python html sanitizer bleach also removes the closing /.

>>> bleach.clean("<img />", tags=["img"])
'<img>'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions