Update guides generation to use Nokogiri's HTML5 parser #48521
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation / Background
Use Nokogiri::HTML5 to generate the guides. This doesn't meaningfully change the output, but will help ensure we're emitting valid HTML5 markup. A followup commit could reasonably rip out the W3C validator, I think.
Note that the most frequent changes to the output are:
>
and<
are not escaped per the HTML5 spec which may be surprising to look at if you're used to libxml2's output.Detail
This Pull Request replaces calls to
Nokogiri::HTML.fragment
with a call to a new private method,html_fragment
which uses eitherNokogiri::HTML5.fragment
if HTML5 available, elseNokogiri::HTML4.fragment
.Additional information
Part of an ongoing effort to update Rails to use HTML5.
Checklist
Before submitting the PR make sure the following are checked:
[Fix #issue-number]