Skip to content

Commit 5decf52

Browse files
theletterfclaude
andauthored
fix(site): hide external link arrow when anchor wraps an image (#3165)
* fix(site): hide external link arrow when anchor wraps an image The external-link arrow rendered by a[target='_blank']::after was appearing alongside image-only links (screenshots, badges like the AWS "Launch Stack" button), producing a redundant indicator next to content that already conveys the target. Scope the pseudo-element to anchors that do not contain an <img> using :not(:has(img)), and document the behavior in docs/syntax/links.md. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs: add Linked images example under Links Demonstrate the image-in-link markdown pattern and explain that the external-link arrow is suppressed when the anchor wraps an image. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs: render a live linked-image example under Links Use the existing bear.png asset and example.com as the destination so readers can see the image-wrapped link (and verify the arrow indicator is omitted) without external dependencies. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent e6d0881 commit 5decf52

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

docs/syntax/links.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,22 @@ Link to websites and resources outside the Elastic docs:
111111
[Elastic Documentation](https://www.elastic.co/guide)
112112
```
113113

114+
External links display an arrow indicator next to the link text.
115+
116+
### Linked images
117+
118+
Wrap an image in a link to make the image itself clickable. Combine the image syntax with the link syntax:
119+
120+
```markdown
121+
[![A bear](/syntax/images/bear.png "bear =300x")](https://example.com)
122+
```
123+
124+
Rendered:
125+
126+
[![A bear](/syntax/images/bear.png "bear =300x")](https://example.com)
127+
128+
When an external link wraps an image (for example, a screenshot or badge), the arrow indicator is omitted because the image already conveys the target.
129+
114130
### Autolinks
115131

116132
Bare `https://` URLs in text are automatically converted to clickable links.

src/Elastic.Documentation.Site/Assets/markdown/typography.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
a {
5252
@apply font-body text-blue-elastic hover:text-blue-elastic-100 underline;
5353

54-
&[target='_blank']::after {
54+
&[target='_blank']:not(:has(img))::after {
5555
@apply ml-0.5;
5656
content: url("data:image/svg+xml; utf8, <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='grey' height='16'><path d='M6.22 8.72a.75.75 0 0 0 1.06 1.06l5.22-5.22v1.69a.75.75 0 0 0 1.5 0v-3.5a.75.75 0 0 0-.75-.75h-3.5a.75.75 0 0 0 0 1.5h1.69L6.22 8.72Z' /><path d='M3.5 6.75c0-.69.56-1.25 1.25-1.25H7A.75.75 0 0 0 7 4H4.75A2.75 2.75 0 0 0 2 6.75v4.5A2.75 2.75 0 0 0 4.75 14h4.5A2.75 2.75 0 0 0 12 11.25V9a.75.75 0 0 0-1.5 0v2.25c0 .69-.56 1.25-1.25 1.25h-4.5c-.69 0-1.25-.56-1.25-1.25v-4.5Z' /></svg>");
5757
}

0 commit comments

Comments
 (0)