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>
53 lines
1.8 KiB
Plaintext
53 lines
1.8 KiB
Plaintext
package main
|
|
|
|
import "strings"
|
|
|
|
// hashPrefix returns the markdown-style hash prefix for a heading level.
|
|
func hashPrefix(level int) string {
|
|
if level < 1 {
|
|
level = 1
|
|
}
|
|
if level > 6 {
|
|
level = 6
|
|
}
|
|
return strings.Repeat("#", level) + " "
|
|
}
|
|
|
|
func terminalHeadingClass(level int) string {
|
|
switch level {
|
|
case 1:
|
|
return "terminal-heading terminal-heading-1 text-3xl font-bold"
|
|
case 2:
|
|
return "terminal-heading terminal-heading-2 text-2xl font-bold"
|
|
case 3:
|
|
return "terminal-heading terminal-heading-3 text-xl font-semibold"
|
|
case 4:
|
|
return "terminal-heading terminal-heading-4 text-lg font-semibold"
|
|
case 5:
|
|
return "terminal-heading terminal-heading-5 text-base font-medium"
|
|
case 6:
|
|
return "terminal-heading terminal-heading-6 text-base font-medium"
|
|
default:
|
|
return "terminal-heading terminal-heading-2 text-2xl font-bold"
|
|
}
|
|
}
|
|
|
|
templ terminalHeadingComponent(level int, text, textClass string) {
|
|
switch level {
|
|
case 1:
|
|
<h1 class={ terminalHeadingClass(1), textClass } style="text-transform: uppercase;">{ hashPrefix(1) + text }</h1>
|
|
case 2:
|
|
<h2 class={ terminalHeadingClass(2), textClass } style="text-transform: uppercase;">{ hashPrefix(2) + text }</h2>
|
|
case 3:
|
|
<h3 class={ terminalHeadingClass(3), textClass } style="text-transform: uppercase;">{ hashPrefix(3) + text }</h3>
|
|
case 4:
|
|
<h4 class={ terminalHeadingClass(4), textClass } style="text-transform: uppercase;">{ hashPrefix(4) + text }</h4>
|
|
case 5:
|
|
<h5 class={ terminalHeadingClass(5), textClass } style="text-transform: uppercase;">{ hashPrefix(5) + text }</h5>
|
|
case 6:
|
|
<h6 class={ terminalHeadingClass(6), textClass } style="text-transform: uppercase;">{ hashPrefix(6) + text }</h6>
|
|
default:
|
|
<h2 class={ terminalHeadingClass(2), textClass } style="text-transform: uppercase;">{ hashPrefix(2) + text }</h2>
|
|
}
|
|
}
|