Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

Enable anchor links for documentation headings and refactor test fixtures

Maximilian Roos61866ed27b25
diff --git a/docs/config.toml b/docs/config.toml
index 5cbc8ef4b..e59130e18 100644
--- a/docs/config.toml
+++ b/docs/config.toml
@@ -14,6 +14,7 @@ highlight_themes_css = [
{ theme = "base16-ocean-dark", filename = "syntax-dark.css" },
]
error_on_missing_highlight = true
+insert_anchor_links = "heading"
[extra]
logo_name = "Worktrunk"
diff --git a/docs/sass/custom.scss b/docs/sass/custom.scss
index 44c2d425b..917f3b483 100644
--- a/docs/sass/custom.scss
+++ b/docs/sass/custom.scss
@@ -68,17 +68,26 @@ h2 {
position: relative;
display: inline-block;
- // Hand-drawn underline - slightly irregular width
- &::after {
- content: "";
- position: absolute;
- left: 0;
- bottom: -0.3rem;
- width: 45%;
- height: 2px;
- background: var(--wt-color-craft-brown);
- opacity: 0.5;
- border-radius: 1px;
+ // Anchor inside h2 gets the underline (aligns with text)
+ > a {
+ // Hand-drawn underline - turns gold on hover
+ &::after {
+ content: "";
+ position: absolute;
+ left: 0;
+ bottom: -0.3rem;
+ width: 45%;
+ height: 2px;
+ background: var(--wt-color-craft-brown);
+ opacity: 0.5;
+ border-radius: 1px;
+ transition: background 150ms ease-out, opacity 150ms ease-out;
+ }
+
+ &:hover::after {
+ background: var(--wt-color-accent);
+ opacity: 1;
+ }
}
}
@@ -95,7 +104,31 @@ h4 {
font-weight: 550;
}
-// Page title heading (used on content pages)
+// Heading anchor links - entire heading is clickable
+// .heading-anchor = custom anchors in templates, .zola-anchor = Zola-generated
+h1 > a.heading-anchor,
+h2 > a.zola-anchor,
+h3 > a.zola-anchor,
+h4 > a.zola-anchor {
+ color: inherit;
+ text-decoration: none;
+
+ &:hover {
+ text-decoration: none;
+ }
+}
+
+// h3/h4 hover: color shift to accent (h1/h2 have underline intensify via ::after)
+h3 > a.zola-anchor,
+h4 > a.zola-anchor {
+ transition: color 150ms ease-out;
+
+ &:hover {
+ color: var(--wt-color-accent);
+ }
+}
+
+// Page title heading (used on content pages and hero)
.heading-text {
font-family: var(--wt-font-head);
font-size: 1.75rem;
@@ -305,6 +338,8 @@ main {
border-radius: 12px;
border: 1px solid var(--wt-color-border-subtle);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
+ // Account for sticky header when scrolling to page anchor (e.g., /#worktrunk)
+ scroll-margin-top: calc(var(--wt-header-height) + var(--wt-main-padding-top));
}
// Paragraphs
@@ -1150,7 +1185,7 @@ input:focus-visible {
}
// Content links - animated underline
-.content a:not(.button) {
+.content a:not(.button):not(.heading-anchor):not(.zola-anchor) {
position: relative;
&::after {
diff --git a/docs/templates/base.html b/docs/templates/base.html
index 7477c2b28..ba9aac883 100644
--- a/docs/templates/base.html
+++ b/docs/templates/base.html
@@ -154,7 +154,7 @@
{{ macros::toc_nav(docs_section=docs_section) }}
{% endblock toc %}
- <div class="content">
+ <div class="content" id="{% block content_id %}{% endblock content_id %}">
{% block content %}
{{ section.content | safe }}
{% endblock content %}
diff --git a/docs/templates/index.html b/docs/templates/index.html
index d0447eff8..4afd7c510 100644
--- a/docs/templates/index.html
+++ b/docs/templates/index.html
@@ -56,7 +56,7 @@
}
</style>
<section class="text-center welcome">
- <h1 class="heading-text" style="font-size: 50px">Worktrunk</h1>
+ <h1 class="heading-text" style="font-size: 50px"><a href="#worktrunk" class="heading-anchor">Worktrunk</a></h1>
<h3 class="title-text">
Git worktree management for <b style="white-space: nowrap">parallel AI agent workflows</b>
</h3>
@@ -75,10 +75,12 @@
{{ macros::toc_nav(docs_section=docs_section) }}
{% endblock toc %}
+{% block content_id %}worktrunk{% endblock content_id %}
+
{% block content %}
{# Display worktrunk content directly on homepage #}
{% set docs_section = get_section(path="_index.md") %}
{% set worktrunk = docs_section.pages | filter(attribute="slug", value="worktrunk") | first %}
-<div class="heading-text">{{ worktrunk.title }}</div>
+<h1 class="heading-text"><a href="#worktrunk" class="heading-anchor">{{ worktrunk.title }}</a></h1>
{{ worktrunk.content | safe }}
{% endblock content %}
diff --git a/docs/templates/page.html b/docs/templates/page.html
index 457713523..eae02af6b 100644
--- a/docs/templates/page.html
+++ b/docs/templates/page.html
@@ -7,8 +7,10 @@
{{ macros::toc_nav(docs_section=docs_section, current_page=page) }}
{% endblock toc %}
+{% block content_id %}{{ page.slug }}{% endblock content_id %}
+
{% block content %}
-<div class="heading-text">{{ page.title }}</div>
+<h1 class="heading-text"><a href="#{{ page.slug }}" class="heading-anchor">{{ page.title }}</a></h1>
{{ page.content | safe }}
{# Calculate prev/next from section pages #}