Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Docs: Split command pages with --help-page generation
Maximilian Rooseb32114a0855
diff --git a/docs/templates/index.html b/docs/templates/index.htmlindex 9ee3843f6..6f95f8180 100644--- a/docs/templates/index.html+++ b/docs/templates/index.html@@ -1,4 +1,5 @@{% extends "base.html" %}+{% import "macros.html" as macros %}{% block hero %}<script async defer src="https://buttons.github.io/buttons.js"></script>@@ -93,17 +94,7 @@{% block toc %}{% set docs_section = get_section(path="_index.md") %}-<div class="toc">- <div class="toc-sticky">- {% for doc_page in docs_section.pages %}- <div class="toc-item">- <a class="subtext" href="{{ doc_page.permalink | safe }}">- {{ doc_page.title }}- </a>- </div>- {% endfor %}- </div>-</div>+{{ macros::toc_nav(docs_section=docs_section) }}{% endblock toc %}{% block content %}diff --git a/docs/templates/macros.html b/docs/templates/macros.htmlnew file mode 100644index 000000000..445a4d71f--- /dev/null+++ b/docs/templates/macros.html@@ -0,0 +1,43 @@+{% macro toc_nav(docs_section, current_page=false) %}+<div class="toc">+ <div class="toc-sticky">+ {% set current_group = "" %}+ {% for doc_page in docs_section.pages %}+ {% set is_current = current_page and doc_page.permalink == current_page.permalink %}+ {% set page_group = doc_page.extra.group | default(value="") %}++ {# Show group label when group changes #}+ {% if page_group != current_group and page_group != "" %}+ <div class="toc-group-label">{{ page_group }}</div>+ {% set_global current_group = page_group %}+ {% endif %}++ <div class="toc-item">+ <a class="subtext {% if is_current %}active{% endif %}" href="{{ doc_page.permalink | safe }}">+ {{ doc_page.title }}+ </a>+ </div>++ {# Show page TOC for current page #}+ {% if is_current and current_page.toc %}+ {% for h in current_page.toc %}+ <div class="toc-item-child">+ <a class="subtext" href="{{ h.permalink | safe }}">+ <small>{{ h.title }}</small>+ </a>+ </div>+ {% if h.children %}+ {% for h2 in h.children %}+ <div class="toc-item-child nested">+ <a class="subtext" href="{{ h2.permalink | safe }}">+ <small>{{ h2.title }}</small>+ </a>+ </div>+ {% endfor %}+ {% endif %}+ {% endfor %}+ {% endif %}+ {% endfor %}+ </div>+</div>+{% endmacro toc_nav %}diff --git a/docs/templates/page.html b/docs/templates/page.htmlindex d7b1980cd..70fc06eba 100644--- a/docs/templates/page.html+++ b/docs/templates/page.html@@ -1,49 +1,11 @@{% extends "base.html" %}+{% import "macros.html" as macros %}{% block title %}{{ page.title }} | {{ config.title }}{% endblock title %}{% block toc %}{% set docs_section = get_section(path="_index.md") %}-<div class="toc">- <div class="toc-sticky">- {% set current_group = "" %}- {% for doc_page in docs_section.pages %}- {% set is_current = doc_page.permalink == page.permalink %}- {% set page_group = doc_page.extra.group | default(value="") %}-- {# Show group label when group changes #}- {% if page_group != current_group and page_group != "" %}- <div class="toc-group-label">{{ page_group }}</div>- {% set_global current_group = page_group %}- {% endif %}-- <div class="toc-item">- <a class="subtext {% if is_current %}active{% endif %}" href="{{ doc_page.permalink | safe }}">- {{ doc_page.title }}- </a>- </div>-- {% if is_current and page.toc %}- {% for h in page.toc %}- <div class="toc-item-child">- <a class="subtext" href="{{ h.permalink | safe }}">- <small>{{ h.title }}</small>- </a>- </div>- {% if h.children %}- {% for h2 in h.children %}- <div class="toc-item-child nested">- <a class="subtext" href="{{ h2.permalink | safe }}">- <small>{{ h2.title }}</small>- </a>- </div>- {% endfor %}- {% endif %}- {% endfor %}- {% endif %}- {% endfor %}- </div>-</div>+{{ macros::toc_nav(docs_section=docs_section, current_page=page) }}{% endblock toc %}{% block content %}