package wiki import ( "fmt" "strings" ) // htmlIndexTemplate is a self-contained viewer that loads the per-repo // markdown pages (relative to the wrapping HTML file) and renders them // via marked + Mermaid.js from CDN. It's a minimal nav-by-anchor // experience: clicking the sidebar links replaces the right pane's // content with the matching markdown file fetched and rendered // client-side. const htmlIndexTemplate = ` __TITLE__

Loading...

` // RenderHTMLIndex builds a self-contained HTML viewer for one repo. // It does not enumerate every community page at build time — the user // navigates by clicking the markdown links inside the rendered pages. // The Communities entry is a placeholder; community pages are reached // from within index.md. func RenderHTMLIndex(repoSlug string, opts Options) string { title := repoSlug + " — Gortex wiki" if opts.Project != "" { title = opts.Project + " · " + title } out := strings.ReplaceAll(htmlIndexTemplate, "__TITLE__", htmlEscape(title)) _ = fmt.Sprintf // keep fmt usable for future tweaks return out } func htmlEscape(s string) string { r := strings.NewReplacer( "&", "&", "<", "<", ">", ">", "\"", """, ) return r.Replace(s) }