How can I render Mermaid diagrams directly in Confluence and Jira from Mermaid source?

My team stores Mermaid diagrams in Confluence and Jira pages, but we don’t want to maintain both the Mermaid source and exported PNG/JPEG images. Every diagram change requires regenerating and replacing the image, which is tedious and creates the risk that the rendered diagram will drift out of sync with the actual Mermaid source.

We’d prefer to keep Mermaid as the single source of truth and have the diagrams rendered automatically from the Mermaid text. Is there a solution for this?