Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously an unversioned directory inside ~/src/blockninja-themes/terminal. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
28 lines
526 B
Plaintext
28 lines
526 B
Plaintext
package main
|
|
|
|
func tocAnchorHref(anchor string) string {
|
|
if anchor == "" {
|
|
return "#"
|
|
}
|
|
return "#" + anchor
|
|
}
|
|
|
|
templ tocComponent(data TocData) {
|
|
<nav class="terminal-toc" data-block="terminal:toc">
|
|
<h4>{ data.Heading }</h4>
|
|
if len(data.Items) > 0 {
|
|
<ul>
|
|
for _, item := range data.Items {
|
|
<li>
|
|
<a href={ templ.SafeURL(tocAnchorHref(item.Anchor)) }>
|
|
{ "§ " + item.Label }
|
|
</a>
|
|
</li>
|
|
}
|
|
</ul>
|
|
} else {
|
|
<p class="terminal-mono">{ "// no sections yet" }</p>
|
|
}
|
|
</nav>
|
|
}
|