Add linked image syntax without fancybox gallery#116
Merged
Conversation
Owner
|
@copilot tou can actually just take the caption (if it's there) and call the existing transformCaption function (ignore what I said about opening it in new tab, just use the existing transformCaption logic) |
- Add transformLinkedImages function to handle [](url) pattern - Support optional caption with *caption text* - Generate figure elements with target="_blank" links - Do NOT include data-fancybox attribute for linked images - Update transformLinksToTargetBlank to avoid duplicate target attributes - Add comprehensive tests for all scenarios Co-authored-by: pjohnst5 <35265851+pjohnst5@users.noreply.github.com>
- Add explanatory comment for linkedImageRE regex pattern - Fix absoluteLinkRE regex to properly match all anchor tags with http URLs - Remove extra blank lines to match existing code style Co-authored-by: pjohnst5 <35265851+pjohnst5@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add functionality to display images with captions in markdown
Add linked image syntax without fancybox gallery
Dec 20, 2025
Apply same logic as transformCaption for determining when to add target="_blank": - External links (starting with "http") get target="_blank" - Internal links (starting with "/" or "#") do not get target="_blank" This matches the existing behavior throughout the codebase. Co-authored-by: pjohnst5 <35265851+pjohnst5@users.noreply.github.com>
Contributor
Author
Done in 2dd48e8. Now following the same logic as transformCaption: external links (starting with "http") get target="_blank", while internal links (starting with "/" or "#") do not. |
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.
Adds support for clickable images that link to URLs without triggering the fancybox gallery. Useful for images that should navigate to another page rather than open in a lightbox.
Changes
New
transformLinkedImagesfunction: Processes[](url)pattern before standard image processing<figure>with<a>wrapper (nodata-fancybox)transformCaptionfor target attribute: external links (starting with "http") gettarget="_blank", internal links do not*caption text*with markdown processingFixed
transformLinksToTargetBlank: Now skips links that already havetarget="_blank"to avoid duplicate attributesUsage
External link (opens in new tab):
Generates:
Internal link (same tab):
Generates:
Standard image syntax
continues to use fancybox gallery behavior.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.