Module: Rigor::ModuleGraph::HtmlView
- Defined in:
- lib/rigor/module_graph/html_view.rb
Overview
Self-contained HTML document that embeds Mermaid output inline so it renders without any local server (works over file://, no fetch).
The view loads mermaid@10 from a CDN at render time. The only network access is that one CDN URL; if a project needs to ship a fully offline page, render the SVG via Graphviz and embed that instead.
The HTML body lives in lib/rigor/module_graph/templates/view.html.erb; bumping styling or Mermaid init options is an edit of that file alone.
Constant Summary collapse
- TEMPLATE_PATH =
File.("templates/view.html.erb", __dir__)
Class Method Summary collapse
-
.render(title:, mermaid_source:, subtitle: nil) ⇒ String
The rendered HTML document.
- .template ⇒ Object
Class Method Details
.render(title:, mermaid_source:, subtitle: nil) ⇒ String
Returns the rendered HTML document.
29 30 31 32 33 34 35 36 |
# File 'lib/rigor/module_graph/html_view.rb', line 29 def render(title:, mermaid_source:, subtitle: nil) indented = mermaid_source.strip.gsub("\n", "\n ") template.result_with_hash( title: title, subtitle: subtitle, indented_mermaid: indented ) end |
.template ⇒ Object
38 39 40 |
# File 'lib/rigor/module_graph/html_view.rb', line 38 def template @template ||= ERB.new(File.read(TEMPLATE_PATH), trim_mode: "-") end |