From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jarmo Hurri Subject: Request: change SVG embedding in exported HTML Date: Sat, 23 Jul 2016 15:53:44 +0300 Message-ID: <87oa5oqzvr.fsf@iki.fi> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58904) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQwRT-0006ci-5F for emacs-orgmode@gnu.org; Sat, 23 Jul 2016 08:54:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bQwRP-0008J1-0U for emacs-orgmode@gnu.org; Sat, 23 Jul 2016 08:54:06 -0400 Received: from plane.gmane.org ([80.91.229.3]:35242) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQwRO-0008Ia-Pq for emacs-orgmode@gnu.org; Sat, 23 Jul 2016 08:54:02 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1bQwRM-0004zw-JY for emacs-orgmode@gnu.org; Sat, 23 Jul 2016 14:54:00 +0200 Received: from 82-181-168-52.bb.dnainternet.fi ([82.181.168.52]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 23 Jul 2016 14:54:00 +0200 Received: from jarmo.hurri by 82-181-168-52.bb.dnainternet.fi with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 23 Jul 2016 14:54:00 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org Greetings. Request: An SVG file embedded in exported HTML should be embedded using the tag instead of . Short reasoning: The displayed size of the SVG image can not be controlled from outside the SVG file when embedded using , but size can be controlled when embedded using . Here is the longer explanation. The HTML exporter currently embeds SVG as an object. Here is an example of the HTML produced by the exporter:

Sorry, your browser does not support SVG.

I have in the past couple of days found out that there is a serious disadvantage to this: the displayed size of the resulting web page image can not be controlled in any reasonable manner; see, for example https://css-tricks.com/scale-svg/ However, the size _can_ be controlled if embedding is done with an . For example, the exported code above could be
I have included 'class="org-svg"' above so that embedded SVG images can then be distinguished from other images in CSS files. For example, the following CSS then sets the width of SVG images to be 80% of the width of the viewport. .org-svg { width: 80vw; } Current embedding using has a nice textual fallback property for browsers not capable of SVG (I have no idea if this support is necessary nowadays). If need be, such fallback could also be added to embedding using . See http://www.w3schools.com/jsref/event_onerror.asp Jarmo