From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/33045 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Christophe Demko Newsgroups: gmane.text.pandoc Subject: Re: Inline SVG in markdown, converted to ODT Date: Fri, 11 Aug 2023 03:23:32 -0700 (PDT) Message-ID: <181d94a6-f783-45a6-8d93-284a6674b977n@googlegroups.com> References: <3ed4f0e5-ad35-4aaa-81c8-4e5766b88896n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_2894_465465454.1691749412046" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6366"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDN5TJEC4AEBBJMY3CTAMGQE5727W4Y-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Fri Aug 11 12:23:39 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-pj1-f62.google.com ([209.85.216.62]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1qUPIw-0001Pz-LO for gtp-pandoc-discuss@m.gmane-mx.org; Fri, 11 Aug 2023 12:23:38 +0200 Original-Received: by mail-pj1-f62.google.com with SMTP id 98e67ed59e1d1-268113acd37sf3402992a91.0 for ; Fri, 11 Aug 2023 03:23:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20221208; t=1691749417; x=1692354217; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:x-original-sender :mime-version:subject:references:in-reply-to:message-id:to:from:date :sender:from:to:cc:subject:date:message-id:reply-to; bh=DiiRO7Z+m+8rEJSegy1UhYsK+hqk4uDV9OHyoh/EmCU=; b=sRJqrEk50BxrBwPKXFUeofw0IB4IFE9FpjoMnO3nVZNIVR8AE91t15nAH77uzPtfsw TaLeD8HGgrGllQHO43pTjqyjRlOaT5olnkFmOlsNk7NrGBD/tK516kMVfgn/PDkRLVd/ vdgdPMo153MC3nfSMW49hdxQexHTl5uiHaU24jGk6q2QzYrvSO8G5vi/N5KGny8HjWhL gWXsXVidRit1gOXJ8MQX3hqfavSN3PrQPfhY0f+wY6J124tFwJ3A17AW/cfvND250ZbJ MVUizIhmxJgzPQrR13b0R6Cxc+zaPi4/P292/eVwxs0s6MQjonLd1x0oLc0Zc9QnLzR7 x28g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691749417; x=1692354217; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:x-original-sender :mime-version:subject:references:in-reply-to:message-id:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=DiiRO7Z+m+8rEJSegy1UhYsK+hqk4uDV9OHyoh/EmCU=; b=siJTXhfUIET4fMnon4JPiTOZjLXsUtRQvVOSKVl9U9VrG+pe7quCHVpSleU0lf15iJ FYsBvs9KHVurG8QX4a6yy+XNOOpE0tvcKe8Qgd6B5m1U+eR/t0XYboImPPdKks2MybqV S/6D46rRy1d8gp0FjDC6fRgstayymWBSOO/ufY/AY2H5Ya2V3Em2gLfzvSGcnm0/EeY6 uBMrnxUIMySp24TeM+uR/VrFokRHU8EYow9dE/4/gwUiB3mB5XEneQC+kKPghF7hqMtl lCf3R9F9A9og17Bt+BDS912Y2mckMm1HorLxH4iKC8pHN5VAVgcr0avaQuFpUS5iW5fu KKZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691749417; x=1692354217; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence:reply-to :x-original-sender:mime-version:subject:references:in-reply-to :message-id:to:from:date:x-beenthere:x-gm-message-state:sender:from :to:cc:subject:date:message-id:reply-to; bh=DiiRO7Z+m+8rEJSegy1UhYsK+hqk4uDV9OHyoh/EmCU=; b=lU2ZKEdYB1bW3E6qGHuzu9sry90PevtFEaHj+dwNrDwr2ZUTcwDa6zVhllRxBzQaHe e/uyPISlMFAWNGmfu0ta106IeugZCXw8R0A6rEDnfK0COxhas6o7c215fDToelz1gVJl wFQ6IPPEijTCkeGy+NW7NiQ76tqO8znMeStbwtHmEl6VXGJNMAUyNzFUNPl1EE1zkoJG v7ls/SneXFI2nOuMW/3kE/EFwc9qcn6hShRXlkziXtZXhKpSg2tk1sNu3/SkqykPs3U4 O2slnzC9yj6XyNojf9D9ASnacnV0hz1BOtnin/2EpZWs6lEN+W Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOJu0YzRrnZq7ce9wKddpcFZEJFOG06kiq9BChox3ThXMxtNU+3KLqtz bGO1w6ZYX70Ueck+APZ86O4= X-Google-Smtp-Source: AGHT+IFmkWMxxzHzC3H6gAiZr3umMy1OhwFAyslzXpdfOiSKdgxe3OJZVCcZGlNK+Ijf+A5WKtry4w== X-Received: by 2002:a17:90a:eac4:b0:262:e589:678f with SMTP id ev4-20020a17090aeac400b00262e589678fmr2084560pjb.10.1691749417141; Fri, 11 Aug 2023 03:23:37 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a17:90b:2394:b0:263:f40e:e736 with SMTP id mr20-20020a17090b239400b00263f40ee736ls1275991pjb.0.-pod-prod-02-us; Fri, 11 Aug 2023 03:23:33 -0700 (PDT) X-Received: by 2002:a17:902:da90:b0:1bc:8249:2547 with SMTP id j16-20020a170902da9000b001bc82492547mr499620plx.12.1691749412907; Fri, 11 Aug 2023 03:23:32 -0700 (PDT) In-Reply-To: <3ed4f0e5-ad35-4aaa-81c8-4e5766b88896n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Original-Sender: chdemko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.io gmane.text.pandoc:33045 Archived-At: ------=_Part_2894_465465454.1691749412046 Content-Type: multipart/alternative; boundary="----=_Part_2895_717474745.1691749412046" ------=_Part_2895_717474745.1691749412046 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable You could write a filter that convert a Inline SVG image defined by plain= =20 text into a Inline SVG image defined by BASE64 Le jeudi 10 ao=C3=BBt 2023 =C3=A0 15:39:40 UTC+2, nopria a =C3=A9crit : > Following other tentatives=20 > of=20 > markdown to DOCX conversion containing external SVG, I tried to convert t= o=20 > ODT a markdown containing **inline** SVG, such as the one below: > > # Example document > > This is an example of Markdown document with inline embedded SVG images. > > Inline SVG image defined by plain text: > > ![SVG Image](data:image/svg+xml;charset=3Dutf-8, xmlns=3D"http://www.w3.org/2000/svg" width=3D"100" height=3D"100" viewBox= =3D"-150=20 > -150 300 300"> height=3D"200" style=3D"fill:#CCCCFF;stroke:#000099"/>) > > Inline SVG image defined by BASE64 converted text: > > ![SVG=20 > Image](data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+PHN2ZyB4bWxu= cz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIiB= 2aWV3Qm94PSItMTUwIC0xNTAgMzAwIDMwMCI+PHJlY3QgeD0iLTEwMCIgeT0iLTEwMCIgcng9Ij= giIHJ5PSI4IiB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCIgc3R5bGU9ImZpbGw6I0NDQ0NGRjtzd= HJva2U6IzAwMDA5OSIvPjwvc3ZnPg=3D=3D) > > Some math to check if it works; > > $$A_c =3D 23 r^2 - v$$ > > using command > > pandoc example.md -o example.odt > > with Pandoc 3.1.6.1. As you may confirm yourself, the BASE64 inline SVG i= s=20 > correctly converted, while the textual inline SVG is not displayed in the= =20 > resulting ODT and the following warning appears at conversion: > > [WARNING] Could not fetch resource data:image/svg+xml;charset=3Dutf-8 ... > > Given that a BASE64 inline SVG is enough to do the job, I would prefer to= =20 > avoid the BASE64 conversion and go with the plain text inline SVG. > > I already tried html encoding of SVG text and uppercase "utf8" without=20 > success. > > I choose ODT because it's open and because it seems to display SVG=20 > natively without needing PNG conversion (I hope it works with more comple= x=20 > SVG too), which is a great feature. > > Thank in advance for your time. > --=20 You received this message because you are subscribed to the Google Groups "= pandoc-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an e= mail to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/= pandoc-discuss/181d94a6-f783-45a6-8d93-284a6674b977n%40googlegroups.com. ------=_Part_2895_717474745.1691749412046 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable You could write a filter that convert a Inline SVG image defined by plain text into a Inline SVG image defined by BASE64
<= br />
Le j= eudi 10 ao=C3=BBt 2023 =C3=A0 15:39:40 UTC+2, nopria a =C3=A9crit=C2=A0:
Following = other tentatives of markdown to DOCX c= onversion containing external SVG, I tried to convert to ODT a markdown con= taining **inline** SVG, such as the one below:

# Example document

This is an exampl= e of Markdown document with inline embedded SVG images.

Inline SVG i= mage defined by plain text:

![SVG Image](data:image/svg+xml;charset= =3Dutf-8,<?xml version=3D"1.0"?><svg xmlns=3D"http://www.w3.org/2000/svg" width=3D"= 100" height=3D"100" viewBox=3D"-150 -150 300 300"&= gt;<rect x=3D"-100" y=3D"-100" rx=3D"8" ry= =3D"8" width=3D"200" height=3D"200" style=3D&= quot;fill:#CCCCFF;stroke:#000099"/></svg>)

Inline SVG = image defined by BASE64 converted text:

![SVG Image](data:image/svg+= xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5v= cmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIiB2aWV3Qm94PSItMTUwIC0xNTA= gMzAwIDMwMCI+PHJlY3QgeD0iLTEwMCIgeT0iLTEwMCIgcng9IjgiIHJ5PSI4IiB3aWR0aD0iMj= AwIiBoZWlnaHQ9IjIwMCIgc3R5bGU9ImZpbGw6I0NDQ0NGRjtzdHJva2U6IzAwMDA5OSIvPjwvc= 3ZnPg=3D=3D)

Some math to check if it works;

$$A_c =3D 23 r^2= - v$$

using command<= /div>

pandoc exa= mple.md -o example.odt

with Pandoc 3.1.6.1.= As you may confirm yourself, the BASE64 inline SVG is correctly converted,= while the textual inline SVG is not displayed in the resulting ODT and the= following warning appears at conversion:

[WARNING] Could not fetch resource data:ima= ge/svg+xml;charset=3Dutf-8 ...

Given that a= BASE64 inline SVG is enough to do the job, I would prefer to avoid the BAS= E64 conversion and go with the plain text inline SVG.

I already tried html en= coding of SVG text and uppercase "utf8" without success.

I choose ODT because it's open and because it seems to= display SVG natively without needing PNG conversion (I hope it works with = more complex SVG too), which is a great feature.

Thank in advance for your time.

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pand= oc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d= /msgid/pandoc-discuss/181d94a6-f783-45a6-8d93-284a6674b977n%40googlegroups.= com.
------=_Part_2895_717474745.1691749412046-- ------=_Part_2894_465465454.1691749412046--