Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Snaipe opened this issue Feb 7, 2022 · 2 comments
Open

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

Snaipe opened this issue Feb 7, 2022 · 2 comments
Labels
help wanted NeedsFix pkgsite

Comments

@Snaipe
Copy link

@Snaipe Snaipe commented Feb 7, 2022

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?

@Snaipe Snaipe added the pkgsite label Feb 7, 2022
@gopherbot gopherbot added this to the pkgsite/unplanned milestone Feb 7, 2022
@Snaipe
Copy link
Author

@Snaipe Snaipe commented Feb 7, 2022

A workaround for this issue seems to be wrapping the HTML with an outer <div> and putting the align tag on that div. The result is indeed centered.

@jamalc
Copy link

@jamalc jamalc commented Feb 25, 2022

I think it is reasonable to allow the align attribute.

@jamalc jamalc added the NeedsFix label Feb 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted NeedsFix pkgsite
Projects
None yet
Development

No branches or pull requests

3 participants