diff --git a/html.go b/html.go index c93a9ec..54744c2 100644 --- a/html.go +++ b/html.go @@ -69,10 +69,24 @@ var ( "sub", "strong", "strike", - "ul", + "ul", + "table", + "tr", + "td", + "th", + "thead", + "tbody", + } + + alignments = []string{ + "left", + "right", + "center", + } + urlRe = `((https?|ftp):\/\/|\/)[-A-Za-z0-9+&@#\/%?=~_|!:,.;\(\)]+` - tagWhitelist = regexp.MustCompile(`^(<\/?(` + strings.Join(tags, "|") + `)>|<(br|hr)\s?\/?>)$`) + tagWhitelist = regexp.MustCompile(`^(<\/?(` + strings.Join(tags, "|") + `)(\salign="(` + strings.Join(alignments, "|") + `)")?>|<(br|hr)\s?\/?>)$`) anchorClean = regexp.MustCompile(`^(]+")?\s?>|<\/a>)$`) imgClean = regexp.MustCompile(`^(]*")?(\stitle="[^"<>]*")?\s?\/?>)$`) // TODO: improve this regexp to catch all possible entities: