+9
-2
appview/pages/markup/markdown.go
+9
-2
appview/pages/markup/markdown.go
···
122
122
func visitNode(ctx *RenderContext, node *htmlparse.Node) {
123
123
switch node.Type {
124
124
case htmlparse.ElementNode:
125
-
if node.Data == "img" {
125
+
if node.Data == "img" || node.Data == "source" {
126
126
for i, attr := range node.Attr {
127
127
if attr.Key != "src" {
128
128
continue
···
142
142
143
143
func (rctx *RenderContext) Sanitize(html string) string {
144
144
policy := bluemonday.UGCPolicy()
145
-
policy.AllowAttrs("align", "style").Globally()
145
+
146
+
// video
147
+
policy.AllowElements("video")
148
+
policy.AllowAttrs("controls").OnElements("video")
149
+
policy.AllowElements("source")
150
+
policy.AllowAttrs("src", "type").OnElements("source")
151
+
152
+
policy.AllowAttrs("align", "style", "width", "height").Globally()
146
153
policy.AllowStyles(
147
154
"margin",
148
155
"padding",