Class: MARS::Rendering::Html
- Inherits:
-
Object
- Object
- MARS::Rendering::Html
- Defined in:
- lib/mars/rendering/html.rb
Constant Summary collapse
- MERMAID_CDN =
"https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"
Instance Method Summary collapse
-
#initialize(obj) ⇒ Html
constructor
A new instance of Html.
- #render ⇒ Object
Constructor Details
Instance Method Details
#render ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/mars/rendering/html.rb', line 12 def render diagram = @mermaid.graph_mermaid.join("\n") direction = "LR" <<~HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>MARS Workflow</title> <script src="#{MERMAID_CDN}"></script> </head> <body> <pre class="mermaid"> flowchart #{direction} #{diagram} </pre> <script>mermaid.initialize({ startOnLoad: true });</script> </body> </html> HTML end |