Skip to main content

DEFAULT_PAGE_TEMPLATE

Constant DEFAULT_PAGE_TEMPLATE 

Source
pub const DEFAULT_PAGE_TEMPLATE: &str = "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\" />\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n  <title>{% if site_title %}{{ title }} \u{2014} {{ site_title }}{% else %}{{ title }}{% endif %}</title>\n  <script>(function(){try{\n  var s=localStorage.getItem(\'doc-theme\');\n  var t=s||(matchMedia(\'(prefers-color-scheme: light)\').matches?\'light\':\'dark\');\n  document.documentElement.setAttribute(\'data-theme\',t);\n  var w=parseInt(localStorage.getItem(\'doc-left-rail-width\'),10);\n  if(w>=180&&w<=560)document.documentElement.style.setProperty(\'--left-rail-width\',w+\'px\');\n}catch(e){}})();</script>\n  <link rel=\"stylesheet\" href=\"{{ base | safe }}/docgen.css\" />\n  <link rel=\"stylesheet\" href=\"{{ base | safe }}/code.css\" />\n  {% if has_components_css %}<link rel=\"stylesheet\" href=\"{{ base | safe }}/components.css\" />{% endif %}\n  {% if has_math %}<link rel=\"stylesheet\" href=\"{{ base | safe }}/vendor/katex/katex.min.css\" />{% endif %}\n</head>\n{% macro render_nodes(nodes, depth, path) %}\n<ul class=\"docgen-tree\" data-depth=\"{{ depth }}\">\n  {% for node in nodes %}\n    {% if node.kind == \"dir\" %}\n      <li class=\"docgen-tree__group\">\n        <details class=\"docgen-tree__details\" data-tree-path=\"{{ path }}/{{ node.name }}\" open>\n          <summary class=\"docgen-tree__summary{% if node.slug and node.slug == slug %} is-active{% endif %}\"><span class=\"docgen-tree__chev\" aria-hidden=\"true\"></span>{% if node.slug %}<a class=\"docgen-tree__folder-link\" href=\"{{ base | safe }}/{{ node.slug | safe }}\"{% if node.slug == slug %} aria-current=\"page\"{% endif %}>{{ node.name }}</a>{% else %}{{ node.name }}{% endif %}</summary>\n          {{ render_nodes(node.children, depth + 1, path ~ \"/\" ~ node.name) }}\n        </details>\n      </li>\n    {% else %}\n      <li class=\"docgen-tree__item{% if node.slug == slug %} is-active{% endif %}\">\n        <a class=\"docgen-tree__link\" href=\"{{ base | safe }}/{{ node.slug | safe }}\"{% if node.slug == slug %} aria-current=\"page\"{% endif %}>{{ node.title }}</a>\n      </li>\n    {% endif %}\n  {% endfor %}\n</ul>\n{% endmacro %}\n<body class=\"docgen-app\" x-data=\"{ navOpen: false }\" @keydown.escape.window=\"navOpen=false\">\n  <a class=\"docgen-skip-link\" href=\"#docgen-main\">Skip to content</a>\n  <header class=\"docgen-topbar\">\n    <a class=\"docgen-topbar__brand\" href=\"{{ base | safe }}/\">\n      <span class=\"docgen-brand-mark\" aria-hidden=\"true\"></span>\n      <span class=\"docgen-brand-name\">{% if site_title %}{{ site_title }}{% else %}Docs{% endif %}</span>\n    </a>\n    <div class=\"docgen-topbar__main\">\n      {% if search_enabled %}\n      <button class=\"docgen-search-trigger\" data-docgen-search>\n        <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>\n        <span class=\"docgen-search-trigger__label\">Search pages, headings, Rust refs\u{2026}</span>\n        <kbd class=\"docgen-kbd\">\u{2318}K</kbd>\n      </button>\n      {% endif %}\n      <div class=\"docgen-topbar__actions\">\n        <div class=\"docgen-btn-strip\" role=\"group\" aria-label=\"Layout\">\n          {% if has_diff %}\n          <a class=\"docgen-ctl--diff icon-only\" href=\"{{ base | safe }}/diff\" aria-label=\"Show documentation diff\" title=\"Show documentation diff\">\n            <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>\n          </a>\n          {% endif %}\n          <button type=\"button\" class=\"docgen-ctl--fullwidth icon-only\" aria-pressed=\"false\" aria-label=\"Toggle full page width\" title=\"Toggle full page width\">\n            <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>\n          </button>\n          <button type=\"button\" class=\"docgen-ctl--rail icon-only\" aria-pressed=\"true\" aria-label=\"Toggle page info\" title=\"Toggle page info\">\n            <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>\n          </button>\n        </div>\n        <div class=\"docgen-theme-toggle\" x-data=\"docgenThemeToggle\" role=\"tablist\" aria-label=\"Theme\">\n          <button type=\"button\" class=\"docgen-theme-toggle__btn\" :class=\"{ \'is-active\': theme===\'dark\' }\" :aria-pressed=\"theme===\'dark\'\" @click=\"set(\'dark\')\" aria-label=\"Dark\">\n            <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>\n          </button>\n          <button type=\"button\" class=\"docgen-theme-toggle__btn\" :class=\"{ \'is-active\': theme===\'light\' }\" :aria-pressed=\"theme===\'light\'\" @click=\"set(\'light\')\" aria-label=\"Light\">\n            <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>\n          </button>\n        </div>\n        <button class=\"docgen-sidebar-toggle\" aria-label=\"Toggle navigation\" aria-controls=\"docgen-sidebar\" :aria-expanded=\"navOpen ? \'true\' : \'false\'\" @click=\"navOpen=!navOpen\">\n          <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>\n        </button>\n      </div>\n    </div>\n  </header>\n  <div class=\"docgen-sidebar-backdrop\" x-show=\"navOpen\" @click=\"navOpen=false\" x-cloak></div>\n  <div class=\"docgen-layout\">\n    <nav class=\"docgen-sidebar\" id=\"docgen-sidebar\" :class=\"{ \'is-open\': navOpen }\">\n      {{ render_nodes(tree, 0, \"\") }}\n    </nav>\n    <div class=\"docgen-rail-resizer\" role=\"separator\" aria-orientation=\"vertical\" aria-label=\"Resize sidebar\" tabindex=\"-1\"></div>\n    <main class=\"docgen-content\" id=\"docgen-main\" tabindex=\"-1\">\n      {% if home %}\n      <section class=\"docgen-home\">\n        <header class=\"docgen-home__head\">\n          <div>\n            <h1 class=\"docgen-home__title\">{% if site_title %}{{ site_title }}{% else %}{{ title }}{% endif %}</h1>\n            {% if home.description %}<p class=\"docgen-home__sub\">{{ home.description }}</p>{% endif %}\n          </div>\n          <div class=\"docgen-home__stats\">\n            <div class=\"docgen-home__stat\"><div class=\"docgen-home__stat-num\">{{ home.pages }}</div><div class=\"docgen-home__stat-lbl\">pages</div></div>\n            <div class=\"docgen-home__stat\"><div class=\"docgen-home__stat-num\">{{ home.links }}</div><div class=\"docgen-home__stat-lbl\">links</div></div>\n            {% if commit %}<div class=\"docgen-home__stat\"><div class=\"docgen-home__stat-num\">{{ commit }}</div><div class=\"docgen-home__stat-lbl\">commit</div></div>{% endif %}\n          </div>\n        </header>\n        {% if search_enabled %}\n        <button class=\"docgen-home__search\" data-docgen-search>\n          <svg viewBox=\"0 0 24 24\" width=\"15\" height=\"15\" 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>\n          <span class=\"docgen-home__search-ph\">Use \u{2318}K or / anywhere to search \u{2014} or open the documentation</span>\n          <span class=\"docgen-home__search-hint\">search</span>\n        </button>\n        {% endif %}\n        {% if home.sections or home.recent %}\n        <div class=\"docgen-home__grid\">\n          {% if home.sections %}\n          <div class=\"docgen-home__col\">\n            <div class=\"docgen-home__col-title\"><span>Sections</span><span>{{ home.sections | length }}</span></div>\n            <div class=\"docgen-home__cards\">\n              {% for s in home.sections %}\n              <a class=\"docgen-home__card\" href=\"{{ base | safe }}/{{ s.slug | safe }}\">\n                <span class=\"docgen-home__card-title\">{{ s.label }}</span>\n                <span class=\"docgen-home__card-meta\"><b>{{ s.count }}</b> pages</span>\n              </a>\n              {% endfor %}\n            </div>\n          </div>\n          {% endif %}\n          {% if home.recent %}\n          <div class=\"docgen-home__col\">\n            <div class=\"docgen-home__col-title\"><span>Recent</span><span>{{ home.recent | length }}</span></div>\n            <ul class=\"docgen-home__recent\">\n              {% for r in home.recent %}\n              <li>\n                <span class=\"docgen-home__recent-when\">{% if r.section %}{{ r.section }}{% else %}\u{2014}{% endif %}</span>\n                <a class=\"docgen-home__recent-what\" href=\"{{ base | safe }}/{{ r.slug | safe }}\">{{ r.title }}</a>\n              </li>\n              {% endfor %}\n            </ul>\n          </div>\n          {% endif %}\n        </div>\n        {% endif %}\n      </section>\n      {% endif %}\n      {% if not home %}\n      <header class=\"docgen-doc-header\">\n        <h1 class=\"docgen-doc-title\">{{ title }}</h1>\n        {% if description %}<p class=\"docgen-doc-lede\">{{ description }}</p>{% endif %}\n      </header>\n      {% endif %}\n      <article class=\"docgen-doc-content\">\n        {{ body | safe }}\n      </article>\n      {% if is_home and graph_json %}\n      <section class=\"docgen-home-graph\" aria-label=\"Documentation graph\">\n        <div class=\"docgen-home-graph__head\">\n          <h2>Doc graph</h2>\n          <span class=\"docgen-graph__meta\">{{ graph_node_count }} nodes &middot; {{ graph_edge_count }} links</span>\n        </div>\n        <div class=\"docgen-graph\" x-data=\"docgenGraph\">\n          <svg class=\"docgen-graph__svg\" viewBox=\"0 0 1420 760\" preserveAspectRatio=\"xMidYMid meet\" role=\"img\" aria-label=\"Document link graph\"></svg>\n        </div>\n        <script type=\"application/json\" id=\"docgen-graph-data\">{{ graph_json | safe }}</script>\n      </section>\n      {% endif %}\n    </main>\n    <aside class=\"docgen-rail\" aria-label=\"Page navigation and information\">\n      {% if headings %}\n      <section class=\"docgen-rail__section\">\n        <h2>On this page</h2>\n        <nav class=\"docgen-rail__toc\" aria-label=\"On this page\">\n          {% for h in headings %}\n          <a class=\"docgen-rail__toc-link{% if h.depth == 3 %} is-depth-3{% endif %}\" href=\"#{{ h.id | safe }}\" data-toc-id=\"{{ h.id | safe }}\">{{ h.text }}</a>\n          {% endfor %}\n        </nav>\n      </section>\n      {% endif %}\n      <section class=\"docgen-rail__section\">\n        <h2>Additional info</h2>\n        <div class=\"docgen-rail__info\">\n          <div class=\"docgen-rail__info-row\">\n            <span>Path</span>\n            <a href=\"{{ base | safe }}/{{ slug | safe }}\">/{{ slug }}</a>\n          </div>\n          <div class=\"docgen-rail__info-row\">\n            <span>Layer</span>\n            <strong>{% if \"/\" in slug %}{{ (slug | split(\"/\")) | first }}{% elif slug %}{{ slug }}{% else %}home{% endif %}</strong>\n          </div>\n          {% if commit %}\n          <div class=\"docgen-rail__info-row\">\n            <span>Commit</span>\n            <strong>{{ commit }}</strong>\n          </div>\n          {% endif %}\n          {% if built %}\n          <div class=\"docgen-rail__info-row\">\n            <span>Built</span>\n            <strong>{{ built }}</strong>\n          </div>\n          {% endif %}\n        </div>\n      </section>\n      {% if backlinks %}\n      <section class=\"docgen-rail__section\">\n        <h2>Referenced by</h2>\n        <div class=\"docgen-rail__backlinks\">\n          {% for bl in backlinks %}\n          <a class=\"docgen-rail__backlink\" href=\"{{ base | safe }}/{{ bl.slug | safe }}\">\n            <span>{{ bl.title }}</span>\n            {% if bl.description %}<small>{{ bl.description }}</small>{% endif %}\n          </a>\n          {% endfor %}\n        </div>\n      </section>\n      {% endif %}\n    </aside>\n  </div>\n  <!-- island infra: bootstrap defines the registry; islands self-register; Alpine starts last -->\n  <script>window.DOCGEN_BASE = {{ base | tojson | safe }};</script>\n  <script src=\"{{ base | safe }}/bootstrap.js\"></script>\n  <script src=\"{{ base | safe }}/islands/theme-toggle.js\"></script>\n  <script src=\"{{ base | safe }}/islands/layout.js\"></script>\n  <script src=\"{{ base | safe }}/islands/scrollspy.js\"></script>\n  <script src=\"{{ base | safe }}/islands/wikilink.js\"></script>\n  {% if search_enabled %}<script src=\"{{ base | safe }}/search.js\" defer></script>{% endif %}\n  {% if is_home and graph_json %}<script src=\"{{ base | safe }}/islands/graph.js\"></script>{% endif %}\n  {% if has_mermaid %}<script src=\"{{ base | safe }}/islands/mermaid.js\"></script>{% endif %}\n  {% if has_component_island %}<script src=\"{{ base | safe }}/components.js\"></script>{% endif %}\n  <script src=\"{{ base | safe }}/vendor/alpine/alpine.min.js\" defer></script>\n</body>\n</html>\n";
Expand description

The built-in page template, embedded at compile time.