code: def railroad_to_html(
      diagrams: List[NamedDiagram], embed=False, **kwargs
  ) -> str:
      """
      Given a list of NamedDiagram, produce a single HTML string that visualises those diagrams
      :params kwargs: kwargs to be passed in to the template
      """
      data = []
      for diagram in diagrams:
          if diagram.diagram is None:
              continue
          io = StringIO()
          try:
              css = kwargs.get("css")
              diagram.diagram.writeStandalone(io.write, css=css)
          except AttributeError:
              diagram.diagram.writeSvg(io.write)
          title = diagram.name
          if diagram.index == 0:
              title += " (root)"
          data.append(
              {"title": title, "text": "", "svg": io.getvalue()}
          )
  
      return template.render(diagrams=data, embed=embed, **kwargs)
  
imports: import railroad
  import pyparsing
  import typing
  from typing import List, NamedTuple, Generic, TypeVar, Dict, Callable, Set, Iterable
  from jinja2 import Template
  from io import StringIO
  import inspect
label_desc: Use image node_id 1 for calling a global function with example usage: railroad_to_html(diagrams, embed) and returns: template