docgen-render 0.1.1

HTML rendering for docgen, the Cargo-only static documentation-site generator
Documentation
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <title>{% if site_title %}Graph — {{ site_title }}{% else %}Graph{% endif %}</title>
  <script>(function(){try{
  var s=localStorage.getItem('doc-theme');
  var t=s||(matchMedia('(prefers-color-scheme: light)').matches?'light':'dark');
  document.documentElement.setAttribute('data-theme',t);
  var w=parseInt(localStorage.getItem('doc-left-rail-width'),10);
  if(w>=180&&w<=560)document.documentElement.style.setProperty('--left-rail-width',w+'px');
}catch(e){}})();</script>
  <link rel="stylesheet" href="{{ base | safe }}/docgen.css" />
  <link rel="stylesheet" href="{{ base | safe }}/code.css" />
</head>
{% macro render_nodes(nodes, depth) %}
<ul class="docgen-tree" data-depth="{{ depth }}">
  {% for node in nodes %}
    {% if node.kind == "dir" %}
      <li class="docgen-tree__group">
        <details class="docgen-tree__details" open>
          <summary class="docgen-tree__summary"><span class="docgen-tree__chev" aria-hidden="true"></span>{{ node.name }}</summary>
          {{ render_nodes(node.children, depth + 1) }}
        </details>
      </li>
    {% else %}
      <li class="docgen-tree__item{% if node.slug == slug %} is-active{% endif %}">
        <a class="docgen-tree__link" href="{{ base | safe }}/{{ node.slug | safe }}"{% if node.slug == slug %} aria-current="page"{% endif %}>{{ node.title }}</a>
      </li>
    {% endif %}
  {% endfor %}
</ul>
{% endmacro %}
<body class="docgen-app" x-data="{ navOpen: false }" @keydown.escape.window="navOpen=false">
  <a class="docgen-skip-link" href="#docgen-main">Skip to content</a>
  <header class="docgen-topbar">
    <a class="docgen-topbar__brand" href="{{ base | safe }}/">
      <span class="docgen-brand-mark" aria-hidden="true"></span>
      <span class="docgen-brand-name">{% if site_title %}{{ site_title }}{% else %}Docs{% endif %}</span>
    </a>
    <div class="docgen-topbar__main">
      {% if search_enabled %}
      <button class="docgen-search-trigger" data-docgen-search>
        <svg class="docgen-search-trigger__icon" viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="M21 21l-4.3-4.3"/></svg>
        <span class="docgen-search-trigger__label">Search pages, headings, Rust refs…</span>
        <kbd class="docgen-kbd">⌘K</kbd>
      </button>
      {% endif %}
      <div class="docgen-topbar__actions">
        <div class="docgen-btn-strip" role="group" aria-label="Layout">
          {% if has_diff %}
          <a class="docgen-ctl--diff icon-only" href="{{ base | safe }}/diff" aria-label="Show documentation diff" title="Show documentation diff">
            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 4v16M18 4v16"/><path d="M9 8h6M9 16h6M12 5v6M12 13v6"/></svg>
          </a>
          {% endif %}
          <button type="button" class="docgen-ctl--fullwidth icon-only" aria-pressed="false" aria-label="Toggle full page width" title="Toggle full page width">
            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 3H3v5M16 3h5v5M21 16v5h-5M3 16v5h5"/></svg>
          </button>
          <button type="button" class="docgen-ctl--rail icon-only" aria-pressed="true" aria-label="Toggle page info" title="Toggle page info">
            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M4 6h16M4 12h16M4 18h16"/></svg>
          </button>
        </div>
        <div class="docgen-theme-toggle" x-data="docgenThemeToggle" role="tablist" aria-label="Theme">
          <button type="button" class="docgen-theme-toggle__btn" :class="{ 'is-active': theme==='dark' }" :aria-pressed="theme==='dark'" @click="set('dark')" aria-label="Dark">
            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z"/></svg>
          </button>
          <button type="button" class="docgen-theme-toggle__btn" :class="{ 'is-active': theme==='light' }" :aria-pressed="theme==='light'" @click="set('light')" aria-label="Light">
            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/></svg>
          </button>
        </div>
        <button class="docgen-sidebar-toggle" aria-label="Toggle navigation" aria-controls="docgen-sidebar" :aria-expanded="navOpen ? 'true' : 'false'" @click="navOpen=!navOpen">
          <svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M3 6h18M3 12h18M3 18h18"/></svg>
        </button>
      </div>
    </div>
  </header>
  <div class="docgen-sidebar-backdrop" x-show="navOpen" @click="navOpen=false" x-cloak></div>
  <div class="docgen-layout">
    <nav class="docgen-sidebar" id="docgen-sidebar" :class="{ 'is-open': navOpen }">
      {{ render_nodes(tree, 0) }}
    </nav>
    <div class="docgen-rail-resizer" role="separator" aria-orientation="vertical" aria-label="Resize sidebar" tabindex="-1"></div>
    <main class="docgen-content docgen-graph-page" id="docgen-main" tabindex="-1">
      <article class="docgen-doc-content">
        <h1>Doc graph</h1>
        <p class="docgen-graph__meta">{{ node_count }} nodes &middot; {{ edge_count }} links</p>
        <div class="docgen-graph" x-data="docgenGraph">
          <svg class="docgen-graph__svg" viewBox="0 0 1420 760" preserveAspectRatio="xMidYMid meet" role="img" aria-label="Document link graph"></svg>
        </div>
        <script type="application/json" id="docgen-graph-data">{{ graph_json | safe }}</script>
      </article>
    </main>
    <aside class="docgen-rail"></aside>
  </div>
  {% if search_enabled %}
  <script src="{{ base | safe }}/search.js" defer></script>
  {% endif %}
  <!-- island infra: bootstrap defines the registry; the graph island self-registers; Alpine starts last -->
  <script>window.DOCGEN_BASE = {{ base | tojson | safe }};</script>
  <script src="{{ base | safe }}/bootstrap.js"></script>
  <script src="{{ base | safe }}/islands/theme-toggle.js"></script>
  <script src="{{ base | safe }}/islands/layout.js"></script>
  <script src="{{ base | safe }}/islands/wikilink.js"></script>
  <script src="{{ base | safe }}/islands/graph.js"></script>
  <script src="{{ base | safe }}/vendor/alpine/alpine.min.js" defer></script>
</body>
</html>