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

Remove trailing forward slash from void elements #922

Merged

Conversation

samford
Copy link
Member

@samford samford commented Jan 12, 2023

It's not necessary to self-close a void element in HTML5 and this is the cause of a lot of validation noise for us (unless restricted to only errors). We currently have void elements that use a trailing forward slash and some that don't, so this PR removes the forward slash from related elements.

Unfortunately, our generated HTML will continue to include trailing forward slashes in void elements from the jekyll-feed and jekyll-seo-tag gems (where we can't control the output) but we can at least address this in our templates.

This is based on #918 and #919 (including changes from both), so it will need to be merged after those PRs but it should cleanly rebase after #919.

@MikeMcQuaid
Copy link
Member

Unfortunately, our generated HTML will continue to include trailing forward slashes in void elements from the jekyll-feed and jekyll-seo-tag gems (where we can't control the output) but we can at least address this in our templates.

Is it really worth addressing here then?

Bo98
Bo98 previously approved these changes Jan 12, 2023
Copy link
Member

@Bo98 Bo98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine as is tbh, even if it just means establishing a consistent styling across our templates, instead of being a bit random.

@Bo98
Copy link
Member

Bo98 commented Jan 12, 2023

our generated HTML will continue to include trailing forward slashes in void elements from the jekyll-feed and jekyll-seo-tag gems (where we can't control the output)

This is because these need to maintain compatibility with XHTML. You'll just have to ignore them.

@MikeMcQuaid
Copy link
Member

You'll just have to ignore them.

or submit upstream PR(s) to fix them?

@samford
Copy link
Member Author

samford commented Jan 12, 2023

Unfortunately, our generated HTML will continue to include trailing forward slashes in void elements from the jekyll-feed and jekyll-seo-tag gems (where we can't control the output) but we can at least address this in our templates.

Is it really worth addressing here then?

I think there's still something to be said for having consistency in our own code and it doesn't hurt to cut down on the validation noise a little bit.

This is because these need to maintain compatibility with XHTML. You'll just have to ignore them.

or submit upstream PR(s) to fix them?

I took a quick glance earlier and it seems like it would only require adding a configuration option, modifying the [gem's] template to use the option, and updating related tests. I'm definitely not the first person to want control over this behavior, so I was thinking about creating upstream PRs sometime in the future (unless I run into some kind of blocker in the process).

@samford samford force-pushed the remove-slash-from-void-elements branch from 5377623 to 9a38652 Compare January 13, 2023 14:29
@MikeMcQuaid
Copy link
Member

To be honest I'm 👎🏻 on this change at least until it's fixed upstream too, sorry.

@Bo98
Copy link
Member

Bo98 commented Jan 27, 2023

Meh, personally I would prioritise template consistency over caring about what libraries do under the hood.

I see this as defining a consistent style in our templates. Right now it's a dice roll what style we use, e.g. line 13 vs line 16 in newsletter.html, line 11 vs 25 in base.html

@colindean
Copy link
Contributor

Looking into this a bit, jekyll-seo-tag's template has self-closing tags and these are ~needed because Jekyll technically supports XHTML still (evidenced here and here, no official documentation alluding it beyond mentions in the changelog.

I opened jekyll/jekyll-seo-tag#486 about it.

@colindean
Copy link
Contributor

@samford and I talked about this earlier... he's got a fork of jekyll-seo-tag with the necessary changes already made (and very similar to my napkin plan) so we'll see if the authors respond on the aforementioned issue. If they're receptive, then perhaps Sam can put up the change and we'll go from there.

Much ado about slashes, haha.

@samford
Copy link
Member Author

samford commented Feb 7, 2023

I'm currently seeing if I can reimplement my Jekyll plugin changes to use parameters (like you suggested in the issue) instead of site values (my current implementation), since that's maybe a bit nicer.

@github-actions
Copy link

github-actions bot commented Mar 1, 2023

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale label Mar 1, 2023
@colindean
Copy link
Contributor

@samford I know there are a bajillion other far more important things…

and I'm commenting to keep this PR open.

@github-actions github-actions bot removed the stale label Mar 1, 2023
MikeMcQuaid
MikeMcQuaid previously approved these changes Mar 1, 2023
@MikeMcQuaid MikeMcQuaid enabled auto-merge March 1, 2023 12:28
@MikeMcQuaid
Copy link
Member

Once conflicts are resolved: let's just merge this. I don't care enough either way.

It's not necessary to self-close a void element in HTML5 and this is
the cause of a lot of validation noise for us (unless restricted to
only errors). We currently have void elements that use a trailing
forward slash and some that don't, so this commit removes the forward
slash from related elements.

Unfortunately, our generated HTML will continue to include trailing
forward slashes in void elements from the `jekyll-feed` and
`jekyll-seo-tag` gems (where we can't control the output) but we can
at least address this in our templates.
@samford samford force-pushed the remove-slash-from-void-elements branch from 9a38652 to 331d394 Compare March 1, 2023 12:33
@MikeMcQuaid MikeMcQuaid merged commit 37a666a into Homebrew:master Mar 1, 2023
@samford samford deleted the remove-slash-from-void-elements branch March 1, 2023 12:35
@MikeMcQuaid
Copy link
Member

Thanks for quick fix here @samford 🙇🏻

@samford
Copy link
Member Author

samford commented Mar 1, 2023

Once I've finished working through some brew (and homebrew/cask) PRs, I'll see about wrapping up my changes on the jekyll-feed and jekyll-seo-tag gems to make it possible to control those slashes. It's still an open question whether upstream would merge the changes but it doesn't hurt to try.

Outside of that, I still need to look into adding HTML validation (using vnu) to CI.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants