fix: keep pseudo-element rules that can't be inlined - #665
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or 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
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.
Closes #293
With the default
removeStyleTags: true, rules using::first-letter,::first-line,::marker,::selectionor::placeholderwere silently dropped: they can't be inlined, but they weren't kept in the<style>tag either. So a drop cap like this one disappeared completely, even in email clients that support::first-letter:These now go in the default
ignoredPseudos, next tohover,activeand friends, which is exactly what that list is for: skip inlining, keep the rule in a<style>tag (controlled bypreservePseudos). Both::and the legacy:syntax work.Output for the example above:
Note that this keeps
::first-letterrules in the<style>tag rather than inlining them as<span>s likeinlinePseudoElementsdoes for::before/::after. Wrapping the first letter correctly (leading punctuation, emoji, nested elements, interplay with::before) is a lot more involved, and::first-linecan't be done statically at all.Added tests for each pseudo-element, both syntaxes,
preservePseudos: false, and regular rules still being inlined alongside. Also updated theignoredPseudosdefault in the README.🤖 Generated with Claude Code