Option to inline SVG image

Nothing is perfect! This is where you can post your ideas and wishes for functions you'd like to see in Help & Manual. Current version only please (H&M7).

Moderators: Alexander Halser, Tim Green

Post Reply
Simon_Dismore
Posts: 205
Joined: Thu Jul 13, 2017 2:57 pm

Option to inline SVG image

Unread post by Simon_Dismore »

How about having a (per-image) option for the compiler to insert an image's SVG file contents directly into the HTML during WebHelp publishing?
User avatar
Tim Green
Site Admin
Posts: 23157
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Option to inline SVG image

Unread post by Tim Green »

Hi Simon,
How about having a (per-image) option for the compiler to insert an image's SVG file contents directly into the HTML during WebHelp publishing?
Interesting idea, but I think it's a bit more involved than just inlining the content. It only really works with very simple icon-style SVGs with a single path, and sometimes you need to remove the fill attribute and make other changes. Then there are SVG sprites, which are a completely different kettle of fish: There you need to combine multiple SVGs into a single block of code in the template, along with IDs, and insert them by referencing their IDs. Also considerably more than just pasting SVG code.
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Simon_Dismore
Posts: 205
Joined: Thu Jul 13, 2017 2:57 pm

Re: Option to inline SVG image

Unread post by Simon_Dismore »

Tim Green wrote:Hi Simon,
How about having a (per-image) option for the compiler to insert an image's SVG file contents directly into the HTML during WebHelp publishing?
Interesting idea, but I think it's a bit more involved than just inlining the content. It only really works with very simple icon-style SVGs with a single path, and sometimes you need to remove the fill attribute and make other changes. Then there are SVG sprites, which are a completely different kettle of fish: There you need to combine multiple SVGs into a single block of code in the template, along with IDs, and insert them by referencing their IDs. Also considerably more than just pasting SVG code.
Yes, it's not necessarily simple. Nevertheless, for SVG files that the author has created specifically for H&M, it might be helpful to have the option to incorporate them inline.

I've been playing with using SVG-injector to load SVG content into H+M topics at run time. Works so long as there's no <script> in the SVG file, but it is difficult to get the CSS right because the injector code overrides the specificity of selectors. When I've got time I'll try to fork a version that doesn't have that limitation. But getting the compiler to do the inlining would be simpler.
Post Reply