After a lot of tinkering and trial and error, I am pleased to announce that I have a mermaid.js custom widget working!
The mermaid.js widget needs read access, and it needs to know which column contains the mermaid.js text. It will take the mermaid.js text and render it to a mermaid.js chart.
Here is an example Grist table using the widget: Grist Widgets - Grist
The custom widget is available at this url: https://nicobako.github.io/grist-widgets/mermaid/index.html
The source code is available here: grist-widgets/mermaid at main · nicobako/grist-widgets · GitHub.
I may end up moving the urls around, but if someone wanted to try this out and let me know what they think, that would be great! I hope the Grist community will find this useful.