Skip to content

Fix image tag with external source #1348

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 25, 2025
Merged

Conversation

ybiquitous
Copy link
Contributor

When rdoc-image contains an external source, such as https://example.com/path/to/image.svg, the rendered <img> tag is broken. This PR fixes the bug.

For example, I found the problem on the IRB website, where a Markdown image is present as a source.

Rendered HTML on the website https://ruby.github.io/irb/:

<a href="https://badge.fury.io/rb/irb"><img src="https" alt="//badge.fury.io/rb/irb.svg:Gem Version"></a>

Screenshot:

image

Markdown source: https://github.com/ruby/irb/blob/6349b03f64f173a9d31bc9042430e1134f3e1689/doc/Index.md?plain=1#L3

[![Gem Version](https://badge.fury.io/rb/irb.svg)](https://badge.fury.io/rb/irb)

Probably, this bug was introduced in the commit 894b2f1, i.e., https://github.com/ruby/rdoc/releases/tag/v6.13.0.

When `rdoc-image` contains an external source, such as `https://example.com/path/to/image.svg`,
rendered `<img>` tag is broken. This fixes the bug.

For example, I found the problem on the IRB website, where a Markdown image is present as a source.

Rendered HTML on the website <https://ruby.github.io/irb/>:

```html
<a href="https://badge.fury.io/rb/irb"><img src="https" alt="//badge.fury.io/rb/irb.svg:Gem Version"></a>
```

Markdown source: <https://github.com/ruby/irb/blob/6349b03f64f173a9d31bc9042430e1134f3e1689/doc/Index.md?plain=1#L3>

```markdown
[![Gem Version](https://badge.fury.io/rb/irb.svg)](https://badge.fury.io/rb/irb)
```

Probably, this bug was introduced in the commit 894b2f1 (v6.13.0).
@st0012 st0012 added the bug label Apr 25, 2025
Copy link
Member

@st0012 st0012 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

@st0012 st0012 merged commit 330a0f5 into ruby:master Apr 25, 2025
30 checks passed
@ybiquitous ybiquitous deleted the fix-external-img-tag branch April 25, 2025 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants