ソースを参照

add allow attribute `class` to `<code>`

Hongcai Deng 9 年 前
コミット
357c002c03
1 ファイル変更4 行追加0 行削除
  1. 4 0
      modules/base/tool.go

+ 4 - 0
modules/base/tool.go

@@ -28,6 +28,10 @@ import (
 
 var Sanitizer = bluemonday.UGCPolicy()
 
+func init() {
+	Sanitizer.AllowAttrs("class").OnElements("code")
+}
+
 // Encode string to md5 hex value.
 func EncodeMd5(str string) string {
 	m := md5.New()