-
Notifications
You must be signed in to change notification settings - Fork 232
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
Replace metalsmith-tagcleaner with a custom marked renderer #2276
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
✅ You can preview this change here:
To edit notification comments on pull requests, go to your Netlify site settings. |
domoscargin
force-pushed
the
bk-spike-tagcleaner-replacement
branch
from
July 27, 2022 21:22
5a80940
to
d33e4d5
Compare
Makes sense to bump these as part of this work, since they're being used under the hood to transform our files. jstransformer-nunjucks Changelog: https://github.com/jstransformers/jstransformer-nunjucks/blob/master/CHANGELOG.md - The major version bump simply adds the option to use custom Nunjucks loaders jstransformer-marked Changelog: https://github.com/jstransformers/jstransformer-marked/blob/master/HISTORY.md
domoscargin
force-pushed
the
bk-spike-tagcleaner-replacement
branch
from
July 27, 2022 21:43
e5d8ce0
to
2100ebd
Compare
36degrees
reviewed
Aug 1, 2022
This better matches how things are done in Marked, and allows us to user `super` for cases other than images. Co-authored-by: Oliver Byford <oliver.byford@digital.cabinet-office.gov.uk>
domoscargin
force-pushed
the
bk-spike-tagcleaner-replacement
branch
from
August 1, 2022 09:46
8551f82
to
eb58287
Compare
36degrees
approved these changes
Aug 1, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Replaces
metalsmith-tagcleaner
with a custom marked renderer which we pass to@metalsmith/in-place
during conversion of our.njk
files to HTML.Why
metalsmith-tagcleaner
is an unmaintained metalsmith plugin to remove<p>
tags from around<img>
tags. It runs after we've generated our HTML from our markdown and Nunjucks files.In addition to a coupla NPM audit warnings, it recently started giving warnings during
npm install
:How
We process our
.njk
files into HTML using@metalsmith/in-place
. This relies on jstransformers under the hood, specificallyjstransformer-marked
, which allows us to pass in the normalmarked
options.This means rather than loop over our HTML files checking the contents after they've been generated, we can instead use a custom
marked
renderer and avoid wrapping the images while the files are being converted. This should net us a small performance benefit.Other notes
I've also bumped
marked
and bothjstransformer
packages. Think it makes sense to include them in this PR as they're what we're using under the hood. Changelogs are in the commit.