Fix and refactor markdown rendering (#32522)
(cherry picked from commit 5eebe1dc5fb29a162c51d050396fce7b14e47f4e) Conflicts: models/repo/repo.go models/repo/repo_test.go modules/markup/html.go modules/markup/html_commit.go modules/markup/html_email.go modules/markup/html_emoji.go modules/markup/html_internal_test.go modules/markup/html_issue.go modules/markup/html_link.go modules/markup/html_node.go modules/markup/html_test.go modules/markup/markdown/goldmark.go modules/markup/markdown/markdown_test.go modules/markup/markdown/transform_image.go modules/markup/orgmode/orgmode.go modules/markup/orgmode/orgmode_test.go modules/markup/render.go modules/markup/render_links.go modules/templates/util_render.go modules/templates/util_render_test.go routers/common/markup.go routers/web/feed/convert.go routers/web/repo/wiki.go but a few lines survived and are useful
This commit is contained in:
parent
a8f2002a9b
commit
45435a8789
2 changed files with 4 additions and 4 deletions
|
@ -39,7 +39,7 @@ const (
|
||||||
// SanitizerRules implements markup.Renderer
|
// SanitizerRules implements markup.Renderer
|
||||||
func (Renderer) SanitizerRules() []setting.MarkupSanitizerRule {
|
func (Renderer) SanitizerRules() []setting.MarkupSanitizerRule {
|
||||||
return []setting.MarkupSanitizerRule{
|
return []setting.MarkupSanitizerRule{
|
||||||
{Element: "div", AllowAttr: "class", Regexp: regexp.MustCompile(playerClassName)},
|
{Element: "div", AllowAttr: "class", Regexp: regexp.MustCompile("^" + playerClassName + "$")},
|
||||||
{Element: "div", AllowAttr: playerSrcAttr},
|
{Element: "div", AllowAttr: playerSrcAttr},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,9 +37,9 @@ func (Renderer) Extensions() []string {
|
||||||
// SanitizerRules implements markup.Renderer
|
// SanitizerRules implements markup.Renderer
|
||||||
func (Renderer) SanitizerRules() []setting.MarkupSanitizerRule {
|
func (Renderer) SanitizerRules() []setting.MarkupSanitizerRule {
|
||||||
return []setting.MarkupSanitizerRule{
|
return []setting.MarkupSanitizerRule{
|
||||||
{Element: "table", AllowAttr: "class", Regexp: regexp.MustCompile(`data-table`)},
|
{Element: "table", AllowAttr: "class", Regexp: regexp.MustCompile(`^data-table$`)},
|
||||||
{Element: "th", AllowAttr: "class", Regexp: regexp.MustCompile(`line-num`)},
|
{Element: "th", AllowAttr: "class", Regexp: regexp.MustCompile(`^line-num$`)},
|
||||||
{Element: "td", AllowAttr: "class", Regexp: regexp.MustCompile(`line-num`)},
|
{Element: "td", AllowAttr: "class", Regexp: regexp.MustCompile(`^line-num$`)},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue