diff --git a/CHANGELOG.md b/CHANGELOG.md
index f70481f827..de45fb014f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,14 @@
All notable changes to `dash` will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/).
+## [Unreleased]
+
+### Fixed
+
+- [#2043](https://github.com/plotly/dash/pull/2043) Fix bug
+[#2003](https://github.com/plotly/dash/issues/2003) in which
+`dangerously_allow_html=True` + `mathjax=True` works in some cases, and in some cases not.
+
## [2.4.1] - 2022-05-11
### Fixed
diff --git a/components/dash-core-components/src/fragments/Markdown.react.js b/components/dash-core-components/src/fragments/Markdown.react.js
index dcd3fa8d14..420bcb3387 100644
--- a/components/dash-core-components/src/fragments/Markdown.react.js
+++ b/components/dash-core-components/src/fragments/Markdown.react.js
@@ -108,6 +108,20 @@ export default class DashMarkdown extends Component {
)}
/>
),
+ dashMathjax: props => (
+
+ ),
+ };
+
+ const regexMath = value => {
+ const newValue = value.replace(
+ /(\${1,2})((?:\\.|[^$])+)\1/g,
+ function (m, tag, src) {
+ const inline = tag.length === 1 || src.indexOf('\n') === -1;
+ return `Topic
+ Some details
+
Some paragraph
+ + $E = mc^2$ + """, + """ +Some paragraph
+ $E = mc^2$ + """, + """ +Some paragraph
$E = mc^2$ + """, + """ +Some paragraph with $E = mc^2$ inline math
+ """, + ] + + app.layout = html.Div( + [dcc.Markdown(c, dangerously_allow_html=True, mathjax=True) for c in CONTENT] + ) + + dash_dcc.start_server(app) + + dash_dcc.wait_for_element(".MathJax") + assert len(dash_dcc.find_elements((".MathJax"))) == len(CONTENT)