jamesmartin / inline_svg

Embed SVG documents in your Rails views and style them with CSS
MIT License
716 stars 73 forks source link

`inline_svg_tag` Adds extra space after output #149

Closed fredboyle closed 6 months ago

fredboyle commented 1 year ago

In the following example code:

<a href="https://nowhere.invalid"><%= inline_svg_tag "interface/interface_smile.svg" %>No gear</a>

A whitespace character is added to the "No gear" string.

The output ends up being:

<a href="..."><svg>...</svg> No gear</a>

Expected output:

<a href="..."><svg>...</svg>No gear</a>

Investigating the issue a fix was found when modifying lib/inline_svg/transform_pipeline.rb in the "inline_svg" gem by changing line #7 to:

end.to_html.strip!

Could this fix be implemented or is there an alternative solution to remove the extra space that shouldn't be there?

jamesmartin commented 1 year ago

Thanks for opening this issue and suggesting a fix. ✨

Please feel free to open a Pull Request with your suggested change and I'll get it merged into the Gem. Bonus points for writing a test that reproduces the problem. 👍

fa11enangel commented 6 months ago

@fredboyle please close the issue as it was merged/fixed.