golang/go

x/pkgsite: align attribute gets stripped from headings in README.md

Open

#51,045 opened on Feb 7, 2022

View on GitHub
 (2 comments) (0 reactions) (0 assignees)Go (19,008 forks)batch import
NeedsFixhelp wantedpkgsite

Repository metrics

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

Description

What is the URL of the page with the issue?

https://pkg.go.dev/snai.pe/boa@v0.0.0-20220207080157-b18178b71668

What is your user agent?

Mozilla/5.0 (X11; Linux x86_64; rv:96.0) Gecko/20100101 Firefox/96.0

Screenshot

2022-02-07_09:52:35

What did you do?

Here is the source of the README: https://raw.githubusercontent.com/Snaipe/boa/9ac3c07bc342a675b3bd5dbda8ca58c5c5b0ea96/README.md

You'll notice on the first line that the <h1> tag has align="center".

What did you expect to see?

I expected the image to be centered. Github renders the image as such: https://github.com/Snaipe/boa/blob/9ac3c07bc342a675b3bd5dbda8ca58c5c5b0ea96/README.md

What did you see instead?

The image is not centered. It seems to be because the align attribute is not allowed in the sanitized HTML: https://github.com/golang/pkgsite/blob/a70a3c2b473c9294b83bc93a6068c8ebcc9c4ecb/internal/frontend/readme.go#L169

I think allowing the attribute on heading seems innocent enough. Thoughts?

Contributor guide