Skip to content

πŸ“š The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.

fix: html escape rules to allow graphic elements on svg

Smaug673941df06826ab5
diff --git a/backend/utils/escape-html.go b/backend/utils/escape-html.go
index 35cdb3bb..f4dc590b 100644
--- a/backend/utils/escape-html.go
+++ b/backend/utils/escape-html.go
@@ -74,7 +74,8 @@ func InitBluemonday() {
// SVG-specific attributes
policy.AllowAttrs(
"viewBox", "fill-rule", "d", "x", "y", "cx", "cy", "r", "rx", "ry", "points", "stroke", "stroke-width", "fill", "preserveAspectRatio", "xmlns",
- ).OnElements("svg", "path", "line", "polygon", "polyline", "rect", "circle", "ellipse", "text")
+ "xmlns:xlink", "xlink:href", "version", "style", "transform", "width", "height", "x1", "y1", "x2", "y2",
+ ).OnElements("svg", "path", "line", "polygon", "polyline", "rect", "circle", "ellipse", "text", "g")
// Links
policy.AllowAttrs("href", "rel").OnElements("a")