Repository navigation
fix(markdown): do not underline whitespace around linked images - #3236
Open
tmoreiradev wants to merge 1 commit into
Open
tmoreiradev wants to merge 1 commit into
tmoreiradev wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: 585a2f1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This branch has not been deployed
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.
Fixes #3128.
.markdown-bodyunderlines the line break and indentation that sit between<a>and<img>when the pair is authored as nested HTML on separate lines — which is how badge rows inside<p align="center">have to be written. The whitespace is a text node inside the link, inherits itstext-decoration, and paints as an underlined gap on both sides of the badge.The anchor that wraps an image and nothing else becomes a flex container, so the whitespace-only children are dropped and there is nothing left to underline:
Notes:
> imgso links with text and an image keep normal inline flow.:has()is baseline in every browser that still gets.markdown-bodystyles; no fallback needed.script/build-css.jsemits.markdown-body a[href]:has(>img){display:inline-flex}andnpx stylelint src/markdown/images.scssis clean (only the two pre-existingvalue-no-unknown-custom-propertieswarnings elsewhere in the file).patch).Credit to @rich-ayr, who wrote up the reproduction and the proposed rule in the issue.