From 2ff6f906c498c1b742dd8437a09c97ebe29a652a Mon Sep 17 00:00:00 2001 From: s-ol Date: Thu, 24 Oct 2019 19:51:49 +0200 Subject: add mermaid graph convert --- build/server.moon | 1 + mmm/mmmfs/converts.moon | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/build/server.moon b/build/server.moon index 35cc82e..4438836 100644 --- a/build/server.moon +++ b/build/server.moon @@ -63,6 +63,7 @@ class Server deps = [[ + diff --git a/mmm/mmmfs/converts.moon b/mmm/mmmfs/converts.moon index 7a998e8..144da51 100644 --- a/mmm/mmmfs/converts.moon +++ b/mmm/mmmfs/converts.moon @@ -359,4 +359,17 @@ do .innerHTML = html } +if MODE == 'CLIENT' and window.mermaid + id_counter = 1 + table.insert converts, { + inp: 'text/mermaid-graph' + out: 'mmm/dom' + cost: 1 + transform: (source, fileder, key) => + with container = document\createElement 'div' + cb = (svg, two) => + .innerHTML = svg + id_counter += 1 + window.mermaid\render "mermaid-#{id_counter}", source, cb + } converts -- cgit v1.2.3