Improve wrapper handling for how-to links #330
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.
This refactors the handling for how-to links to resolve multiple issues:
body-wrapper
element, which would produce the wrong layoutThis PR moves the processing from within a remark plugin, to specifically within the
EntryText
component, using Cheerio which is probably more likely to be readable to more people (since it effectively follows jQuery's API). This does not add any new dependency; Cheerio was already used for an environment variable that makes upgrades easier to diff. (And Cheerio is what's used extensively for the WCAG 2 build system)In the case of a Note/etc. occurring first, the link is currently moved below the note. Using a contrived, locally-edited example:
This PR also restructures a bit of CSS so that we don't need a remark plugin solely for the purpose of adding a class to a bunch of child elements to increase their font size.
Note that this PR leaves a couple of functions unused in
lib/markdown/guidelines.ts
; I expect those to be useful again later (a further-future PR may move them).FWIW, the diff of
EntryText.astro
might be slightly quieter with whitespace ignored (?w=1
).