Files
bookhoard/templates/docs_templ.go
T
john-okeefe 542fbaf116 docs: add Lunr.js search with fuzzy matching and highlighting
Phase 4 part 1: Add search infrastructure
- Add SearchDoc struct and GenerateSearchIndex to docs handler
- Add stripHTML helper for plain text extraction
- Add ServeSearchIndex endpoint to http handler
- Add /docs/search-index.json route in main.go
- Search index includes all documentation files with ID, title, content, URL
2026-02-02 09:08:37 -05:00

644 lines
49 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.3.977
package templates
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import (
"fmt"
)
func DocsLayout(nav Navigation, doc Document, user User) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<!doctype html><html lang=\"en\"><head><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><title>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(doc.Title)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/docs.templ`, Line: 14, Col: 21}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, " - Bookhoard Documentation</title><link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github-dark.min.css\"><script src=\"https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js\"></script><script src=\"https://cdn.jsdelivr.net/npm/lunr@2.3.9/lunr.min.js\"></script><script src=\"https://cdn.jsdelivr.net/npm/lunr-flex@1.0.5/lunr.flex.min.js\"></script><style>\n\t\t\t\t:root {\n\t\t\t\t\t--bg-primary: #1a1b26;\n\t\t\t\t\t--bg-secondary: #24283b;\n\t\t\t\t\t--text-primary: #c0caf5;\n\t\t\t\t\t--text-secondary: #9aa5ce;\n\t\t\t\t\t--border: #414868;\n\t\t\t\t\t--accent: #7aa2f7;\n\t\t\t\t}\n\t\t\t\tbody {\n\t\t\t\t\tfont-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif;\n\t\t\t\t\tbackground-color: var(--bg-primary);\n\t\t\t\t\tcolor: var(--text-primary);\n\t\t\t\t\tmargin: 0;\n\t\t\t\t\tpadding: 0;\n\t\t\t\t}\n\t\t\t\t.sidebar {\n\t\t\t\t\tposition: fixed;\n\t\t\t\t\tleft: 0;\n\t\t\t\t\ttop: 0;\n\t\t\t\t\tbottom: 0;\n\t\t\t\t\twidth: 280px;\n\t\t\t\t\tbackground-color: var(--bg-secondary);\n\t\t\t\t\tborder-right: 1px solid var(--border);\n\t\t\t\t\toverflow-y: auto;\n\t\t\t\t\tz-index: 50;\n\t\t\t\t}\n\t\t\t\t.main-content {\n\t\t\t\t\tmargin-left: 280px;\n\t\t\t\t\tpadding: 2rem;\n\t\t\t\t\tmax-width: 900px;\n\t\t\t\t}\n\t\t\t\t.nav-section {\n\t\t\t\t\tmargin-bottom: 1.5rem;\n\t\t\t\t}\n\t\t\t\t.nav-section-title {\n\t\t\t\t\tfont-weight: 600;\n\t\t\t\t\tfont-size: 0.875rem;\n\t\t\t\t\ttext-transform: uppercase;\n\t\t\t\t\tletter-spacing: 0.05em;\n\t\t\t\t\tcolor: var(--text-secondary);\n\t\t\t\t\tpadding: 0.75rem 1rem;\n\t\t\t\t\tcursor: pointer;\n\t\t\t\t\tuser-select: none;\n\t\t\t\t}\n\t\t\t\t.nav-item {\n\t\t\t\t\tdisplay: block;\n\t\t\t\t\tpadding: 0.5rem 1rem 0.5rem 2rem;\n\t\t\t\t\tcolor: var(--text-secondary);\n\t\t\t\t\ttext-decoration: none;\n\t\t\t\t\tfont-size: 0.875rem;\n\t\t\t\t\ttransition: color 0.2s;\n\t\t\t\t}\n\t\t\t\t.nav-item:hover {\n\t\t\t\t\tcolor: var(--accent);\n\t\t\t\t}\n\t\t\t\t.nav-item.active {\n\t\t\t\t\tcolor: var(--accent);\n\t\t\t\t\tbackground-color: rgba(122, 162, 247, 0.1);\n\t\t\t\t\tborder-right: 2px solid var(--accent);\n\t\t\t\t}\n\t\t\t\tpre {\n\t\t\t\t\tbackground-color: var(--bg-secondary);\n\t\t\t\t\tborder: 1px solid var(--border);\n\t\t\t\t\tborder-radius: 0.5rem;\n\t\t\t\t\tpadding: 1rem;\n\t\t\t\t\toverflow-x: auto;\n\t\t\t\t}\n\t\t\t\tcode {\n\t\t\t\t\tbackground-color: rgba(122, 162, 247, 0.1);\n\t\t\t\t\tpadding: 0.125rem 0.25rem;\n\t\t\t\t\tborder-radius: 0.25rem;\n\t\t\t\t\tfont-size: 0.875em;\n\t\t\t\t}\n\t\t\t\t.breadcrumb {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\tgap: 0.5rem;\n\t\t\t\t\tfont-size: 0.875rem;\n\t\t\t\t\tcolor: var(--text-secondary);\n\t\t\t\t\tmargin-bottom: 2rem;\n\t\t\t\t}\n\t\t\t\t.breadcrumb a {\n\t\t\t\t\tcolor: var(--accent);\n\t\t\t\t\ttext-decoration: none;\n\t\t\t\t}\n\t\t\t\t.toc {\n\t\t\t\t\tbackground-color: var(--bg-secondary);\n\t\t\t\t\tpadding: 1rem;\n\t\t\t\t\tborder-radius: 0.5rem;\n\t\t\t\t\tmargin-bottom: 2rem;\n\t\t\t\t\tborder: 1px solid var(--border);\n\t\t\t\t}\n\t\t\t\t.toc-item {\n\t\t\t\t\tpadding: 0.25rem 0;\n\t\t\t\t\tdisplay: block;\n\t\t\t\t\tcolor: var(--text-secondary);\n\t\t\t\t\ttext-decoration: none;\n\t\t\t\t\tfont-size: 0.875rem;\n\t\t\t\t}\n\t\t\t\t.toc-item:hover {\n\t\t\t\t\tcolor: var(--accent);\n\t\t\t\t}\n\t\t\t\t.search-box {\n\t\t\t\t\tpadding: 1rem;\n\t\t\t\t\tborder-bottom: 1px solid var(--border);\n\t\t\t\t}\n\t\t\t\t.search-input {\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\tpadding: 0.5rem 0.75rem;\n\t\t\t\t\tborder-radius: 0.375rem;\n\t\t\t\t\tbackground-color: var(--bg-primary);\n\t\t\t\t\tcolor: var(--text-primary);\n\t\t\t\t\tborder: 1px solid var(--border);\n\t\t\t\t\tfont-size: 0.875rem;\n\t\t\t\t}\n\t\t\t\t.search-input:focus {\n\t\t\t\t\toutline: none;\n\t\t\t\t\tborder-color: var(--accent);\n\t\t\t\t}\n\t\t\t\t.mobile-menu-button {\n\t\t\t\t\tdisplay: none;\n\t\t\t\t\tposition: fixed;\n\t\t\t\t\ttop: 1rem;\n\t\t\t\t\tleft: 1rem;\n\t\t\t\t\tz-index: 100;\n\t\t\t\t\tbackground-color: var(--bg-secondary);\n\t\t\t\t\tborder: 1px solid var(--border);\n\t\t\t\t\tborder-radius: 0.375rem;\n\t\t\t\t\tpadding: 0.5rem;\n\t\t\t\t\tcolor: var(--text-primary);\n\t\t\t\t\tcursor: pointer;\n\t\t\t\t}\n\t\t\t\t@media (max-width: 768px) {\n\t\t\t\t\t.sidebar {\n\t\t\t\t\t\ttransform: translateX(-100%);\n\t\t\t\t\t\ttransition: transform 0.3s;\n\t\t\t\t\t}\n\t\t\t\t\t#search-results {\n\t\t\t\t\t\tpadding: 1rem;\n\t\t\t\t\t\tpadding-top: 4rem;\n\t\t\t\t\t}\n\t\t\t\t\t.sidebar.open {\n\t\t\t\t\t\ttransform: translateX(0);\n\t\t\t\t\t}\n\t\t\t\t\t.main-content {\n\t\t\t\t\t\tmargin-left: 0;\n\t\t\t\t\t\tpadding: 1rem;\n\t\t\t\t\t}\n\t\t\t\t\t.mobile-menu-button {\n\t\t\t\t\t\tdisplay: block;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t#search-results {\n\t\t\t\t\tposition: fixed;\n\t\t\t\t\ttop: 0;\n\t\t\t\t\tleft: 0;\n\t\t\t\t\tright: 0;\n\t\t\t\t\tbottom: 0;\n\t\t\t\t\tbackground: rgba(0, 0, 0, 0.95);\n\t\t\t\t\toverflow-y: auto;\n\t\t\t\t\tpadding: 2rem;\n\t\t\t\t\tz-index: 1000;\n\t\t\t\t\tdisplay: none;\n\t\t\t\t}\n\t\t\t\t.search-result {\n\t\t\t\t\tdisplay: block;\n\t\t\t\t\tpadding: 1rem;\n\t\t\t\t\tborder-bottom: 1px solid var(--border);\n\t\t\t\t\tcolor: var(--text-primary);\n\t\t\t\t\ttext-decoration: none;\n\t\t\t\t}\n\t\t\t\t.search-result:hover {\n\t\t\t\t\tbackground: var(--bg-secondary);\n\t\t\t\t}\n\t\t\t\t.result-title {\n\t\t\t\t\tfont-weight: 600;\n\t\t\t\t\tmargin-bottom: 0.5rem;\n\t\t\t\t}\n\t\t\t\t.result-snippet {\n\t\t\t\t\tfont-size: 0.875rem;\n\t\t\t\t\tcolor: var(--text-secondary);\n\t\t\t\t}\n\t\t\t\t.no-results {\n\t\t\t\t\ttext-align: center;\n\t\t\t\t\tpadding: 2rem;\n\t\t\t\t\tcolor: var(--text-secondary);\n\t\t\t\t}\n\t\t\t\tmark {\n\t\t\t\t\tbackground: var(--accent);\n\t\t\t\t\tcolor: white;\n\t\t\t\t\tpadding: 0 0.2rem;\n\t\t\t\t\tborder-radius: 2px;\n\t\t\t\t}\n\t\t\t</style></head><body><button class=\"mobile-menu-button\" onclick=\"toggleSidebar()\"><!-- Search Results Overlay --><div id=\"search-results\"></div></button><!-- Sidebar --><div class=\"sidebar\" id=\"sidebar\"><!-- Search --><div class=\"search-box\"><input type=\"text\" class=\"search-input\" placeholder=\"Search documentation...\" id=\"docs-search\" oninput=\"searchDocs(this.value)\"></div><!-- Navigation Sections -->")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for _, section := range nav.Sections {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "<div class=\"nav-section\"><div class=\"nav-section-title\" onclick=\"toggleSection(this)\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(section.Title)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/docs.templ`, Line: 237, Col: 22}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "</div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if section.Collapsed {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "<div class=\"nav-items\" style=\"display: none;\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for _, item := range section.Items {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "<a href=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var4 templ.SafeURL
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinURLErrs(item.URL)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/docs.templ`, Line: 242, Col: 27}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "\" class=\"nav-item\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(item.Icon)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/docs.templ`, Line: 243, Col: 21}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, " ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(item.Title)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/docs.templ`, Line: 243, Col: 36}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "</a>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "</div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} else {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "<div class=\"nav-items\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for _, item := range section.Items {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "<a href=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var7 templ.SafeURL
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinURLErrs(item.URL)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/docs.templ`, Line: 250, Col: 27}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "\" class=\"nav-item\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(item.Icon)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/docs.templ`, Line: 251, Col: 21}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, " ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(item.Title)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/docs.templ`, Line: 251, Col: 36}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "</a>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "</div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "</div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "</div><!-- Main Content --><div class=\"main-content\"><!-- Breadcrumb -->")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if len(doc.Breadcrumb) > 0 {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "<div class=\"breadcrumb\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for i, crumb := range doc.Breadcrumb {
if i > 0 {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "<span></span>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, " <a href=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var10 templ.SafeURL
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinURLErrs(crumb.URL)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/docs.templ`, Line: 269, Col: 26}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var11 string
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(crumb.Title)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/docs.templ`, Line: 269, Col: 42}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "</a>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "</div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "<!-- Title --><h1 style=\"margin-bottom: 2rem;\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var12 string
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(doc.Title)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/docs.templ`, Line: 275, Col: 48}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "</h1><!-- Table of Contents -->")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if len(doc.TOC) > 0 {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "<div class=\"toc\"><strong style=\"display: block; margin-bottom: 0.5rem; color: var(--text-primary);\">On this page</strong> ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for _, item := range doc.TOC {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "<a href=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var13 templ.SafeURL
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinURLErrs("#" + item.Anchor)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/docs.templ`, Line: 282, Col: 34}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "\" class=\"toc-item\" style=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var14 string
templ_7745c5c3_Var14, templ_7745c5c3_Err = templruntime.SanitizeStyleAttributeValues("margin-left: " + fmt.Sprintf("%drem", item.Level))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/docs.templ`, Line: 282, Col: 112}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var15 string
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(item.Title)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/docs.templ`, Line: 283, Col: 20}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 31, "</a>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "</div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "<!-- Content --><div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = UnsafeHTML(doc.Content).ToComponent().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "</div></div><script>\n\t\t\t\t// Toggle sidebar section\n\t\t\t\tfunction toggleSection(el) {\n\t\t\t\t\tconst items = el.nextElementSibling;\n\t\t\t\t\tif (items.style.display === 'none') {\n\t\t\t\t\t\titems.style.display = 'block';\n\t\t\t\t\t} else {\n\t\t\t\t\t\titems.style.display = 'none';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// Toggle sidebar on mobile\n\t\t\t\tfunction toggleSidebar() {\n\t\t\t\t\tdocument.getElementById('sidebar').classList.toggle('open');\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// Highlight current page in nav\n\t\t\t\tdocument.addEventListener('DOMContentLoaded', function() {\n\t\t\t\t\tconst currentPath = window.location.pathname;\n\t\t\t\t\tdocument.querySelectorAll('.nav-item').forEach(item => {\n\t\t\t\t\t\tif (item.getAttribute('href') === currentPath) {\n\t\t\t\t\t\t\titem.classList.add('active');\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t\t\n\t\t\t\t\t// Initialize syntax highlighting\n\t\t\t\t\thljs.highlightAll();\n\t\t\t\t});\n\n\t\t\t\t// Search state\n\t\t\t\tlet idx;\n\t\t\t\tlet searchResults = [];\n\n\t\t\t\t// Load index on page load\n\t\t\t\tfetch('/docs/search-index.json')\n\t\t\t\t\t.then(r => r.json())\n\t\t\t\t\t.then(data => {\n\t\t\t\t\t\t// Initialize Lunr with fuzzy matching\n\t\t\t\t\t\tidx = lunr(function() {\n\t\t\t\t\t\t\tthis.use(lunr.flex)\n\t\t\t\t\t\t\tthis.ref('id')\n\t\t\t\t\t\t\tthis.field('title', {boost: 10})\n\t\t\t\t\t\t\tthis.field('content', {boost: 1})\n\t\t\t\t\t\t\tdata.forEach(doc => this.add(doc))\n\t\t\t\t\t\t})\n\t\t\t\t\t\tconsole.log('Search index loaded:', data.length, 'documents')\n\t\t\t\t\t})\n\t\t\t\t\t.catch(err => console.error('Failed to load search index:', err));\n\n\t\t\t\t// Search input with debounce\n\t\t\t\tconst searchInput = document.getElementById('docs-search');\n\t\t\t\tconst searchResultsDiv = document.getElementById('search-results');\n\n\t\t\t\tlet debounceTimer;\n\n\t\t\t\tsearchInput.addEventListener('input', (e) => {\n\t\t\t\t\tclearTimeout(debounceTimer);\n\t\t\t\t\tdebounceTimer = setTimeout(() => {\n\t\t\t\t\t\tconst query = e.target.value.trim();\n\n\t\t\t\t\t\tif (query.length < 2) {\n\t\t\t\t\t\t\tsearchResultsDiv.style.display = 'none';\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Search with fuzzy matching\n\t\t\t\t\t\tconst results = idx.search(query, {\n\t\t\t\t\t\t\tfields: {title: {boost: 10}, content: 1},\n\t\t\t\t\t\t\texpand: true\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\t// Store results for highlighting\n\t\t\t\t\t\tsearchResults = results;\n\n\t\t\t\t\t\t// Render results\n\t\t\t\t\t\trenderSearchResults(results, query);\n\t\t\t\t\t}, 150);\n\t\t\t\t});\n\n\t\t\t\t// Render search results\n\t\t\t\tfunction renderSearchResults(results, query) {\n\t\t\t\t\tif (results.length === 0) {\n\t\t\t\t\t\tsearchResultsDiv.innerHTML = '<div class=\"no-results\">No results found</div>';\n\t\t\t\t\t\tsearchResultsDiv.style.display = 'block';\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tsearchResultsDiv.innerHTML = results.map(r => {\n\t\t\t\t\t\tconst doc = getDocById(r.ref);\n\t\t\t\t\t\tif (!doc) return '';\n\n\t\t\t\t\t\tconst snippet = getSnippet(doc.content, query);\n\n\t\t\t\t\t\treturn `\n\t\t\t\t\t\t\t<a href=\"${doc.url}\" class=\"search-result\">\n\t\t\t\t\t\t\t\t<div class=\"result-title\">${doc.title}</div>\n\t\t\t\t\t\t\t\t<div class=\"result-snippet\">${snippet}...</div>\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t`;\n\t\t\t\t\t}).join('');\n\n\t\t\t\t\tsearchResultsDiv.style.display = 'block';\n\t\t\t\t}\n\n\t\t\t\tfunction getDocById(id) {\n\t\t\t\t\t// This would be populated from the index\n\t\t\t\t\t// For now, return a placeholder\n\t\t\t\t\treturn {title: id, url: '/docs/' + id.replace('.md', ''), content: ''};\n\t\t\t\t}\n\n\t\t\t\tfunction getSnippet(content, query) {\n\t\t\t\t\t// Simple snippet extraction\n\t\t\t\t\tconst words = query.toLowerCase().split(/\\s+/);\n\t\t\t\t\tconst contentLower = content.toLowerCase();\n\n\t\t\t\t\tfor (const word of words) {\n\t\t\t\t\t\tconst idx = contentLower.indexOf(word);\n\t\t\t\t\t\tif (idx !== -1) {\n\t\t\t\t\t\t\tconst start = Math.max(0, idx - 50);\n\t\t\t\t\t\t\tconst end = Math.min(content.length, idx + 100);\n\t\t\t\t\t\t\treturn '...' + content.substring(start, end) + '...';\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn content.substring(0, 150) + '...';\n\t\t\t\t}\n\n\t\t\t\t// Close search results when clicking outside\n\t\t\t\tdocument.addEventListener('click', (e) => {\n\t\t\t\t\tif (!searchResultsDiv.contains(e.target) && e.target !== searchInput) {\n\t\t\t\t\t\tsearchResultsDiv.style.display = 'none';\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t</script></body></html>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
func DocsLayoutWithExplorer(nav Navigation, doc Document, user User, explorer APIExplorerData) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var16 := templ.GetChildren(ctx)
if templ_7745c5c3_Var16 == nil {
templ_7745c5c3_Var16 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "<!doctype html><html lang=\"en\"><head><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><title>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var17 string
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(doc.Title)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/docs.templ`, Line: 438, Col: 21}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, " - Bookhoard Documentation</title><link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github-dark.min.css\"><script src=\"https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js\"></script><script src=\"https://cdn.jsdelivr.net/npm/lunr@2.3.9/lunr.min.js\"></script><script src=\"https://cdn.jsdelivr.net/npm/lunr-flex@1.0.5/lunr-flex.min.js\"></script><style>\n\t\t\t\t:root {\n\t\t\t\t\t--bg-primary: #1a1b26;\n\t\t\t\t\t--bg-secondary: #24283b;\n\t\t\t\t\t--text-primary: #c0caf5;\n\t\t\t\t\t--text-secondary: #9aa5ce;\n\t\t\t\t\t--border: #414868;\n\t\t\t\t\t--accent: #7aa2f7;\n\t\t\t\t}\n\t\t\t\tbody {\n\t\t\t\t\tfont-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif;\n\t\t\t\t\tbackground-color: var(--bg-primary);\n\t\t\t\t\tcolor: var(--text-primary);\n\t\t\t\t\tmargin: 0;\n\t\t\t\t\tpadding: 0;\n\t\t\t\t}\n\t\t\t\t.sidebar {\n\t\t\t\t\tposition: fixed;\n\t\t\t\t\tleft: 0;\n\t\t\t\t\ttop: 0;\n\t\t\t\t\tbottom: 0;\n\t\t\t\t\twidth: 280px;\n\t\t\t\t\tbackground-color: var(--bg-secondary);\n\t\t\t\t\tborder-right: 1px solid var(--border);\n\t\t\t\t\toverflow-y: auto;\n\t\t\t\t\tz-index: 50;\n\t\t\t\t}\n\t\t\t\t.main-content {\n\t\t\t\t\tmargin-left: 280px;\n\t\t\t\t\tpadding: 2rem;\n\t\t\t\t\tmax-width: 900px;\n\t\t\t\t}\n\t\t\t\t.nav-section {\n\t\t\t\t\tmargin-bottom: 1.5rem;\n\t\t\t\t}\n\t\t\t\t.nav-section-title {\n\t\t\t\t\tfont-weight: 600;\n\t\t\t\t\tfont-size: 0.875rem;\n\t\t\t\t\ttext-transform: uppercase;\n\t\t\t\t\tletter-spacing: 0.05em;\n\t\t\t\t\tcolor: var(--text-secondary);\n\t\t\t\t\tpadding: 0.75rem 1rem;\n\t\t\t\t\tcursor: pointer;\n\t\t\t\t\tuser-select: none;\n\t\t\t\t}\n\t\t\t\t.nav-item {\n\t\t\t\t\tdisplay: block;\n\t\t\t\t\tpadding: 0.5rem 1rem 0.5rem 2rem;\n\t\t\t\t\tcolor: var(--text-secondary);\n\t\t\t\t\ttext-decoration: none;\n\t\t\t\t\tfont-size: 0.875rem;\n\t\t\t\t\ttransition: color 0.2s;\n\t\t\t\t}\n\t\t\t\t.nav-item:hover {\n\t\t\t\t\tcolor: var(--accent);\n\t\t\t\t}\n\t\t\t\t.nav-item.active {\n\t\t\t\t\tcolor: var(--accent);\n\t\t\t\t\tbackground-color: rgba(122, 162, 247, 0.1);\n\t\t\t\t\tborder-right: 2px solid var(--accent);\n\t\t\t\t}\n\t\t\t\tpre {\n\t\t\t\t\tbackground-color: var(--bg-secondary);\n\t\t\t\t\tborder: 1px solid var(--border);\n\t\t\t\t\tborder-radius: 0.5rem;\n\t\t\t\t\tpadding: 1rem;\n\t\t\t\t\toverflow-x: auto;\n\t\t\t\t}\n\t\t\t\tcode {\n\t\t\t\t\tbackground-color: rgba(122, 162, 247, 0.1);\n\t\t\t\t\tpadding: 0.125rem 0.25rem;\n\t\t\t\t\tborder-radius: 0.25rem;\n\t\t\t\t\tfont-size: 0.875em;\n\t\t\t\t}\n\t\t\t\t.breadcrumb {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\tgap: 0.5rem;\n\t\t\t\t\tfont-size: 0.875rem;\n\t\t\t\t\tcolor: var(--text-secondary);\n\t\t\t\t\tmargin-bottom: 2rem;\n\t\t\t\t}\n\t\t\t\t.breadcrumb a {\n\t\t\t\t\tcolor: var(--accent);\n\t\t\t\t\ttext-decoration: none;\n\t\t\t\t}\n\t\t\t\t.toc {\n\t\t\t\t\tbackground-color: var(--bg-secondary);\n\t\t\t\t\tpadding: 1rem;\n\t\t\t\t\tborder-radius: 0.5rem;\n\t\t\t\t\tmargin-bottom: 2rem;\n\t\t\t\t\tborder: 1px solid var(--border);\n\t\t\t\t}\n\t\t\t\t.toc-item {\n\t\t\t\t\tpadding: 0.25rem 0;\n\t\t\t\t\tdisplay: block;\n\t\t\t\t\tcolor: var(--text-secondary);\n\t\t\t\t\ttext-decoration: none;\n\t\t\t\t\tfont-size: 0.875rem;\n\t\t\t\t}\n\t\t\t\t.toc-item:hover {\n\t\t\t\t\tcolor: var(--accent);\n\t\t\t\t}\n\t\t\t\t.search-box {\n\t\t\t\t\tpadding: 1rem;\n\t\t\t\t\tborder-bottom: 1px solid var(--border);\n\t\t\t\t}\n\t\t\t\t.search-input {\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\tpadding: 0.5rem 0.75rem;\n\t\t\t\t\tborder-radius: 0.375rem;\n\t\t\t\t\tbackground-color: var(--bg-primary);\n\t\t\t\t\tcolor: var(--text-primary);\n\t\t\t\t\tborder: 1px solid var(--border);\n\t\t\t\t\tfont-size: 0.875rem;\n\t\t\t\t}\n\t\t\t\t.search-input:focus {\n\t\t\t\t\toutline: none;\n\t\t\t\t\tborder-color: var(--accent);\n\t\t\t\t}\n\t\t\t\t.mobile-menu-button {\n\t\t\t\t\tdisplay: none;\n\t\t\t\t\tposition: fixed;\n\t\t\t\t\ttop: 1rem;\n\t\t\t\t\tleft: 1rem;\n\t\t\t\t\tz-index: 100;\n\t\t\t\t\tbackground-color: var(--bg-secondary);\n\t\t\t\t\tborder: 1px solid var(--border);\n\t\t\t\t\tborder-radius: 0.375rem;\n\t\t\t\t\tpadding: 0.5rem;\n\t\t\t\t\tcolor: var(--text-primary);\n\t\t\t\t\tcursor: pointer;\n\t\t\t\t}\n\t\t\t\t@media (max-width: 768px) {\n\t\t\t\t\t.sidebar {\n\t\t\t\t\t\ttransform: translateX(-100%);\n\t\t\t\t\t\ttransition: transform 0.3s;\n\t\t\t\t\t}\n\t\t\t\t\t#search-results {\n\t\t\t\t\t\tpadding: 1rem;\n\t\t\t\t\t\tpadding-top: 4rem;\n\t\t\t\t\t}\n\t\t\t\t\t.sidebar.open {\n\t\t\t\t\t\ttransform: translateX(0);\n\t\t\t\t\t}\n\t\t\t\t\t.main-content {\n\t\t\t\t\t\tmargin-left: 0;\n\t\t\t\t\t\tpadding: 1rem;\n\t\t\t\t\t}\n\t\t\t\t\t.mobile-menu-button {\n\t\t\t\t\t\tdisplay: block;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t#search-results {\n\t\t\t\t\tposition: fixed;\n\t\t\t\t\ttop: 0;\n\t\t\t\t\tleft: 0;\n\t\t\t\t\tright: 0;\n\t\t\t\t\tbottom: 0;\n\t\t\t\t\tbackground: rgba(0, 0, 0, 0.95);\n\t\t\t\t\toverflow-y: auto;\n\t\t\t\t\tpadding: 2rem;\n\t\t\t\t\tz-index: 1000;\n\t\t\t\t\tdisplay: none;\n\t\t\t\t}\n\t\t\t\t.search-result {\n\t\t\t\t\tdisplay: block;\n\t\t\t\t\tpadding: 1rem;\n\t\t\t\t\tborder-bottom: 1px solid var(--border);\n\t\t\t\t\tcolor: var(--text-primary);\n\t\t\t\t\ttext-decoration: none;\n\t\t\t\t}\n\t\t\t\t.search-result:hover {\n\t\t\t\t\tbackground: var(--bg-secondary);\n\t\t\t\t}\n\t\t\t\t.result-title {\n\t\t\t\t\tfont-weight: 600;\n\t\t\t\t\tmargin-bottom: 0.5rem;\n\t\t\t\t}\n\t\t\t\t.result-snippet {\n\t\t\t\t\tfont-size: 0.875rem;\n\t\t\t\t\tcolor: var(--text-secondary);\n\t\t\t\t}\n\t\t\t\t.no-results {\n\t\t\t\t\ttext-align: center;\n\t\t\t\t\tpadding: 2rem;\n\t\t\t\t\tcolor: var(--text-secondary);\n\t\t\t\t}\n\t\t\t\tmark {\n\t\t\t\t\tbackground: var(--accent);\n\t\t\t\t\tcolor: white;\n\t\t\t\t\tpadding: 0 0.2rem;\n\t\t\t\t\tborder-radius: 2px;\n\t\t\t\t}\n\t\t\t</style></head><body><button class=\"mobile-menu-button\" onclick=\"toggleSidebar()\"><!-- Search Results Overlay --><div id=\"search-results\"></div></button><!-- Sidebar --><div class=\"sidebar\" id=\"sidebar\"><!-- Search --><div class=\"search-box\"><input type=\"text\" class=\"search-input\" placeholder=\"Search documentation...\" id=\"docs-search\" oninput=\"searchDocs(this.value)\"></div><!-- Navigation Sections -->")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for _, section := range nav.Sections {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "<div class=\"nav-section\"><div class=\"nav-section-title\" onclick=\"toggleSection(this)\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var18 string
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(section.Title)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/docs.templ`, Line: 661, Col: 22}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, "</div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if section.Collapsed {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "<div class=\"nav-items\" style=\"display: none;\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for _, item := range section.Items {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, "<a href=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var19 templ.SafeURL
templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinURLErrs(item.URL)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/docs.templ`, Line: 666, Col: 27}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, "\" class=\"nav-item\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var20 string
templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(item.Icon)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/docs.templ`, Line: 667, Col: 21}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 42, " ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var21 string
templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(item.Title)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/docs.templ`, Line: 667, Col: 36}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 43, "</a>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 44, "</div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} else {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 45, "<div class=\"nav-items\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for _, item := range section.Items {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 46, "<a href=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var22 templ.SafeURL
templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinURLErrs(item.URL)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/docs.templ`, Line: 674, Col: 27}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 47, "\" class=\"nav-item\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var23 string
templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(item.Icon)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/docs.templ`, Line: 675, Col: 21}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 48, " ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var24 string
templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(item.Title)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/docs.templ`, Line: 675, Col: 36}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 49, "</a>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 50, "</div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 51, "</div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 52, "</div><!-- Main Content --><div class=\"main-content\"><!-- Breadcrumb -->")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if len(doc.Breadcrumb) > 0 {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 53, "<div class=\"breadcrumb\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for i, crumb := range doc.Breadcrumb {
if i > 0 {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 54, "<span></span>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 55, " <a href=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var25 templ.SafeURL
templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinURLErrs(crumb.URL)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/docs.templ`, Line: 693, Col: 26}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 56, "\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var26 string
templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(crumb.Title)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/docs.templ`, Line: 693, Col: 42}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 57, "</a>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 58, "</div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 59, "<!-- Title --><h1 style=\"margin-bottom: 2rem;\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var27 string
templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(doc.Title)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/docs.templ`, Line: 699, Col: 48}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 60, "</h1><!-- Table of Contents -->")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if len(doc.TOC) > 0 {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 61, "<div class=\"toc\"><strong style=\"display: block; margin-bottom: 0.5rem; color: var(--text-primary);\">On this page</strong> ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for _, item := range doc.TOC {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 62, "<a href=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var28 templ.SafeURL
templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinURLErrs("#" + item.Anchor)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/docs.templ`, Line: 706, Col: 34}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var28))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 63, "\" class=\"toc-item\" style=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var29 string
templ_7745c5c3_Var29, templ_7745c5c3_Err = templruntime.SanitizeStyleAttributeValues("margin-left: " + fmt.Sprintf("%drem", item.Level))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/docs.templ`, Line: 706, Col: 112}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var29))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 64, "\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var30 string
templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(item.Title)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/docs.templ`, Line: 707, Col: 20}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 65, "</a>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 66, "</div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 67, "<!-- Content --><div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = UnsafeHTML(doc.Content).ToComponent().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 68, "</div><!-- API Explorer -->")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = APIExplorer(explorer).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 69, "</div><script>\n\t\t\t\t// Toggle sidebar section\n\t\t\t\tfunction toggleSection(el) {\n\t\t\t\t\tconst items = el.nextElementSibling;\n\t\t\t\t\tif (items.style.display === 'none') {\n\t\t\t\t\t\titems.style.display = 'block';\n\t\t\t\t\t} else {\n\t\t\t\t\t\titems.style.display = 'none';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// Toggle sidebar on mobile\n\t\t\t\tfunction toggleSidebar() {\n\t\t\t\t\tdocument.getElementById('sidebar').classList.toggle('open');\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// Highlight current page in nav\n\t\t\t\tdocument.addEventListener('DOMContentLoaded', function() {\n\t\t\t\t\tconst currentPath = window.location.pathname;\n\t\t\t\t\tdocument.querySelectorAll('.nav-item').forEach(item => {\n\t\t\t\t\t\tif (item.getAttribute('href') === currentPath) {\n\t\t\t\t\t\t\titem.classList.add('active');\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\t// Initialize syntax highlighting\n\t\t\t\t\thljs.highlightAll();\n\t\t\t\t});\n\n\t\t\t\t// Search state\n\t\t\t\tlet idx;\n\t\t\t\tlet searchResults = [];\n\n\t\t\t\t// Load index on page load\n\t\t\t\tfetch('/docs/search-index.json')\n\t\t\t\t\t.then(r => r.json())\n\t\t\t\t\t.then(data => {\n\t\t\t\t\t\t// Initialize Lunr with fuzzy matching\n\t\t\t\t\t\tidx = lunr(function() {\n\t\t\t\t\t\t\tthis.use(lunr.flex)\n\t\t\t\t\t\t\tthis.ref('id')\n\t\t\t\t\t\t\tthis.field('title', {boost: 10})\n\t\t\t\t\t\t\tthis.field('content', {boost: 1})\n\t\t\t\t\t\t\tdata.forEach(doc => this.add(doc))\n\t\t\t\t\t\t})\n\t\t\t\t\t\tconsole.log('Search index loaded:', data.length, 'documents')\n\t\t\t\t\t})\n\t\t\t\t\t.catch(err => console.error('Failed to load search index:', err));\n\n\t\t\t\t// Search input with debounce\n\t\t\t\tconst searchInput = document.getElementById('docs-search');\n\t\t\t\tconst searchResultsDiv = document.getElementById('search-results');\n\n\t\t\t\tlet debounceTimer;\n\n\t\t\t\tsearchInput.addEventListener('input', (e) => {\n\t\t\t\t\tclearTimeout(debounceTimer);\n\t\t\t\t\tdebounceTimer = setTimeout(() => {\n\t\t\t\t\t\tconst query = e.target.value.trim();\n\n\t\t\t\t\t\tif (query.length < 2) {\n\t\t\t\t\t\t\tsearchResultsDiv.style.display = 'none';\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Search with fuzzy matching\n\t\t\t\t\t\tconst results = idx.search(query, {\n\t\t\t\t\t\t\tfields: {title: {boost: 10}, content: 1},\n\t\t\t\t\t\t\texpand: true\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\t// Store results for highlighting\n\t\t\t\t\t\tsearchResults = results;\n\n\t\t\t\t\t\t// Render results\n\t\t\t\t\t\trenderSearchResults(results, query);\n\t\t\t\t\t}, 150);\n\t\t\t\t});\n\n\t\t\t\t// Render search results\n\t\t\t\tfunction renderSearchResults(results, query) {\n\t\t\t\t\tif (results.length === 0) {\n\t\t\t\t\t\tsearchResultsDiv.innerHTML = '<div class=\"no-results\">No results found</div>';\n\t\t\t\t\t\tsearchResultsDiv.style.display = 'block';\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tsearchResultsDiv.innerHTML = results.map(r => {\n\t\t\t\t\t\tconst doc = getDocById(r.ref);\n\t\t\t\t\t\tif (!doc) return '';\n\n\t\t\t\t\t\tconst snippet = getSnippet(doc.content, query);\n\n\t\t\t\t\t\treturn `\n\t\t\t\t\t\t\t<a href=\"${doc.url}\" class=\"search-result\">\n\t\t\t\t\t\t\t\t<div class=\"result-title\">${doc.title}</div>\n\t\t\t\t\t\t\t\t<div class=\"result-snippet\">${snippet}...</div>\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t`;\n\t\t\t\t\t}).join('');\n\n\t\t\t\t\tsearchResultsDiv.style.display = 'block';\n\t\t\t\t}\n\n\t\t\t\tfunction getDocById(id) {\n\t\t\t\t\t// This would be populated from the index\n\t\t\t\t\t// For now, return a placeholder\n\t\t\t\t\treturn {title: id, url: '/docs/' + id.replace('.md', ''), content: ''};\n\t\t\t\t}\n\n\t\t\t\tfunction getSnippet(content, query) {\n\t\t\t\t\t// Simple snippet extraction\n\t\t\t\t\tconst words = query.toLowerCase().split(/\\s+/);\n\t\t\t\t\tconst contentLower = content.toLowerCase();\n\n\t\t\t\t\tfor (const word of words) {\n\t\t\t\t\t\tconst idx = contentLower.indexOf(word);\n\t\t\t\t\t\tif (idx !== -1) {\n\t\t\t\t\t\t\tconst start = Math.max(0, idx - 50);\n\t\t\t\t\t\t\tconst end = Math.min(content.length, idx + 100);\n\t\t\t\t\t\t\treturn '...' + content.substring(start, end) + '...';\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn content.substring(0, 150) + '...';\n\t\t\t\t}\n\n\t\t\t\t// Close search results when clicking outside\n\t\t\t\tdocument.addEventListener('click', (e) => {\n\t\t\t\t\tif (!searchResultsDiv.contains(e.target) && e.target !== searchInput) {\n\t\t\t\t\t\tsearchResultsDiv.style.display = 'none';\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t</script></body></html>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate