Skip to content

Bugfix: Fix dcc.Markdown issues with <dccLink /> - #3960

Merged
KoolADE85 merged 5 commits into
devfrom
bugfix/3951-markdown-rewrite
Aug 28, 2026
Merged

Bugfix: Fix dcc.Markdown issues with <dccLink />#3960
KoolADE85 merged 5 commits into
devfrom
bugfix/3951-markdown-rewrite

Conversation

@KoolADE85

Copy link
Copy Markdown
Contributor

dcc.Markdown used dependencies that were fundamentally incompatible with our <dccLink /> implementation + React 19 deps.
This PR rewrites the Markdown component to use markdown internals that are compatible.
Along the way, it's converted to Typescript.

dcc.Link is also converted to Typescript (no functional change) so as not to introduce TS compile errors.

Testing notes:

  • while this is a rewrite, I intend for this to be included in a minor release: You can compare against the old Markdown.react.js implementation for parity
  • I added plenty of missing integration tests

Fixes #3951

Contributor Checklist

  • I have run the tests locally and they passed. (refer to testing section in contributing)
  • I have added tests, or extended existing tests, to cover any new features or bugs fixed in this PR

optionals

  • I have added entry in the CHANGELOG.md
  • If this PR needs a follow-up in dash docs, community thread, I have mentioned the relevant URLS as follows
    • this GitHub #PR number updates the dash docs
    • here is the show and tell thread in Plotly Dash community

@KoolADE85
KoolADE85 marked this pull request as ready for review August 28, 2026 16:37
@robertclaus
robertclaus requested a review from T4rk1n August 28, 2026 17:29
Comment on lines +66 to +75
const renderMarkdown = (text: string) => (
<MarkdownContent
dedent={dedent}
dangerously_allow_html={dangerously_allow_html}
mathjax={mathjax}
link_target={link_target}
>
{text}
</MarkdownContent>
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think we can put this in a useCallback

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!


// Reuse a highlight.js instance already on `window` (e.g. supplied by the host
// page), otherwise lazily load the bundled third-party build.
export default (): Promise<HLJSApi> =>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put a name for the export.

}
}

export default (mathjax?: boolean): Promise<MathJaxObject | undefined> =>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name for function.

@T4rk1n T4rk1n left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💃

@sonarqubecloud

Copy link
Copy Markdown

@KoolADE85
KoolADE85 merged commit 5bad579 into dev Aug 28, 2026
53 checks passed
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

Successfully merging this pull request may close these issues.

[BUG] dcc.Markdown with a <dccLink children="..." /> does not render children

2 participants