Fix two problems with image links caused by regex fix - #134
Merged
Conversation
|
|
Commit 2e2cdd2 made regex markdown replacements fire on every match (correctly), which exposed two latent problems in the gif/imgur embed plugins: 1. Double "!": once imgur turned a link into an image, the gif mod matched that image and prepended a second "!", giving "!". 2. Authored links eaten: the plugins turned ANY matching link into an image -- including inline links the author gave descriptive text, e.g. [see animation](https://imgur.com/x) -- discarding the text and the clickable link. (Before 2e2cdd2 such links were only spared by a nondeterministic index-drift bug, never a real rule.) Fix both by only embedding links whose text is an AUTO-GENERATED label, not author prose. The embed regex can see three auto shapes by the time it runs: empty "[]", the literal "[bookmark]" placeholder, and -- in the production config -- the URL repeated as the label, "[http...](http...)", which standardExternalLinkConversion rewrites "[bookmark]" into in an earlier phase (doLinkFixes, see transform.ts). An optional leading "!" also lets us match an already-imaged link without doubling the "!". Tests: cover the double-bang and imgur+gif interaction, authored links staying clickable, and the production path (bookmark -> [url](url) -> embed) both with standardExternalLinkConversion and through the actual default production config, so future config drift can't reopen this. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
andrew-polk
force-pushed
the
fix-image-link-double-bang
branch
from
June 25, 2026 22:10
d8529eb to
3520700
Compare
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.
This change is