golang/go

x/pkgsite: trim the non text elements from subdirectories synopsis

Open

#42,335 opened on Nov 2, 2020

View on GitHub
 (2 comments) (0 reactions) (0 assignees)Go (19,008 forks)batch import
NeedsInvestigationhelp wantedpkgsitepkgsite/dochtml

Repository metrics

Stars
 (133,883 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

synopsis here (I believe this is the line https://github.com/golang/pkgsite/blob/master/content/static/html/pages/subdirectories.tmpl#L19) looks really awkward image as opposed to the image

may I suggest rendering that synopsis to html and removing all non text html elements from that section? something like this might work

depth := 0
summary := bytes.NewBuffer(nil)
for {
	tt := z.Next()
	switch tt {
	case html.ErrorToken:
		break
	case html.TextToken:
		summary.Write(z.Text())
}
return summary.String()

Contributor guide