Although this thread is quite old, this is a problem that vexed me for quite some time so I want to offer an update this thread for anyone coming across this later.
There are now two good options for using Mermaid.JS within TW5:
“Complete” Mermaid.js library installation into TW5: This is the full library, but has been updated as of October 2021 and published with a demo wiki to make installation a breeze. It is however a full library installation (1.2MB).
Demo wiki: Mermaid TW5 Plugin
Lightweight TiddlyWiki5 plugin that wraps Mermaid Live Editor: I just published this as a very lightweight (18kb) “wrapper” of the Mermaid Live service which handles all the rendering. All the power of Mermaid with streamlined code management and virtually no TW bloat.
YouTube: Mermaid.JS Plugin for TiddlyWiki5 - YouTube
GitHub repo: GitHub - jasonmhoule/tw5-mermaid: A lightweight TiddlyWiki5 plugin for managing Mermaid.js tiddlers
Demo wiki: TW5 Mermaid.js plugin — A lightweight TiddlyWiki5 plugin for managing Mermaid.js tiddlers