Add markdown event descriptions for hosts to provide context
Hosts can now add a free-form description (with markdown rendering via goldmark) when creating or editing events. Descriptions render safely with no raw HTML passthrough. Includes ALTER TABLE migration for existing databases. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+23
@@ -0,0 +1,23 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"html/template"
|
||||
|
||||
"github.com/yuin/goldmark"
|
||||
"github.com/yuin/goldmark/renderer/html"
|
||||
)
|
||||
|
||||
var mdRenderer = goldmark.New(
|
||||
goldmark.WithRendererOptions(
|
||||
html.WithHardWraps(),
|
||||
),
|
||||
)
|
||||
|
||||
func RenderMarkdown(input string) template.HTML {
|
||||
var buf bytes.Buffer
|
||||
if err := mdRenderer.Convert([]byte(input), &buf); err != nil {
|
||||
return template.HTML(template.HTMLEscapeString(input))
|
||||
}
|
||||
return template.HTML(buf.String())
|
||||
}
|
||||
Reference in New Issue
Block a user