Source File
policies.go
Belonging Package
github.com/microcosm-cc/bluemonday
package bluemonday
import (
)
func () *Policy {
return StrictPolicy()
}
.AllowElements("article", "aside")
.AllowAttrs(
"open",
).Matching(regexp.MustCompile(`(?i)^(|open)$`)).OnElements("details")
.AllowElements("figure")
.AllowElements("section")
.AllowElements("summary")
.AllowElements("h1", "h2", "h3", "h4", "h5", "h6")
.AllowElements("hgroup")
.AllowAttrs("cite").OnElements("blockquote")
.AllowElements("br", "div", "hr", "p", "span", "wbr")
.AllowAttrs("href").OnElements("a")
.AllowAttrs("name").Matching(
regexp.MustCompile(`^([\p{L}\p{N}_-]+)$`),
).OnElements("map")
.AllowAttrs("alt").Matching(Paragraph).OnElements("area")
.AllowAttrs("coords").Matching(
regexp.MustCompile(`^([0-9]+,)+[0-9]+$`),
).OnElements("area")
.AllowAttrs("href").OnElements("area")
.AllowAttrs("rel").Matching(SpaceSeparatedTokens).OnElements("area")
.AllowAttrs("shape").Matching(
regexp.MustCompile(`(?i)^(default|circle|rect|poly)$`),
).OnElements("area")
.AllowAttrs("usemap").Matching(
regexp.MustCompile(`(?i)^#[\p{L}\p{N}_-]+$`),
).OnElements("img")
.AllowElements("abbr", "acronym", "cite", "code", "dfn", "em",
"figcaption", "mark", "s", "samp", "strong", "sub", "sup", "var")
.AllowAttrs("cite").OnElements("q")
.AllowAttrs("datetime").Matching(ISO8601).OnElements("time")
.AllowElements("b", "i", "pre", "small", "strike", "tt", "u")
.AllowAttrs("dir").Matching(Direction).OnElements("bdi", "bdo")
.AllowElements("rp", "rt", "ruby")
.AllowAttrs("cite").Matching(Paragraph).OnElements("del", "ins")
.AllowAttrs("datetime").Matching(ISO8601).OnElements("del", "ins")
.AllowLists()
.AllowTables()
.AllowAttrs(
"value",
"min",
"max",
"low",
"high",
"optimum",
).Matching(Number).OnElements("meter")
.AllowAttrs("value", "max").Matching(Number).OnElements("progress")
.AllowImages()
return
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |