Wiki Links support

This commit is contained in:
2026-04-21 19:50:16 +02:00
parent 9639a70572
commit e0d2fb0b41
7 changed files with 478 additions and 5 deletions
+13 -5
View File
@@ -15,11 +15,18 @@ import (
"github.com/yuin/goldmark/renderer/html"
)
var md = goldmark.New(
goldmark.WithExtensions(extension.GFM, extension.Table),
goldmark.WithParserOptions(parser.WithAutoHeadingID()),
goldmark.WithRendererOptions(html.WithUnsafe()),
)
var md goldmark.Markdown
// initMarkdown builds the package-level goldmark instance. Called once from
// main after the wiki root is known so the wiki-link extension can resolve
// targets against the filesystem.
func initMarkdown(root string) {
md = goldmark.New(
goldmark.WithExtensions(extension.GFM, extension.Table, newWikiLinkExt(root)),
goldmark.WithParserOptions(parser.WithAutoHeadingID()),
goldmark.WithRendererOptions(html.WithUnsafe()),
)
}
type crumb struct{ Name, URL string }
type entry struct {
@@ -32,6 +39,7 @@ type pageData struct {
Crumbs []crumb
CanEdit bool
EditMode bool
IsRoot bool
SectionIndex int // -1 = whole page; >=0 = section being edited
PostURL string
RawContent string