From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/33049 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: Sat, 12 Aug 2023 11:01:25 -0700 (PDT) Message-ID: <97837349-aaf9-419d-98ca-e793c96beef1n@googlegroups.com> References: <3ed4f0e5-ad35-4aaa-81c8-4e5766b88896n@googlegroups.com> <181d94a6-f783-45a6-8d93-284a6674b977n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_13845_1435423618.1691863285128" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17284"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDN5TJEC4AEBB5UR36TAMGQE27YIAKQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sat Aug 12 20:01:32 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-pl1-f187.google.com ([209.85.214.187]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1qUsvb-0004MX-Oa for gtp-pandoc-discuss@m.gmane-mx.org; Sat, 12 Aug 2023 20:01:31 +0200 Original-Received: by mail-pl1-f187.google.com with SMTP id d9443c01a7336-1bbb97d27d6sf35305995ad.1 for ; Sat, 12 Aug 2023 11:01:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20221208; t=1691863290; x=1692468090; 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=GVQXDzRYxjdJHzzISXJha/R1/7+5Jp/aJX0MK8+MVhg=; b=DfgwBu8jiMvq4Lo//0mLqT2TCQAa80oyC9+6qEYnYa+/ZUsFFK1NtM24OpU4Mqf76f qAe/q6El9By2NRVySTTntgz8z84S/fD1c8d06g+R2lK3myHq8KdhabmVOUZCmQwSVtoI whMoJsnJbi0rZUoaj9lFeMWf+l7jXJp4N3a0nVUD/oMVO3EQoEqmvxXytRseME7ML8Pj 7EU7cGVeUGSS3Erv7rdb14NTRIPucv2+RI1UgVELuuKJ49+O0Fkpp1DOKGNQLs1JiXMY 7jwPW+Pafp2wTMtGC5aM2fHxtTe9Tj+dwpagvcaMokmUaR/njMJnuibQhubj82BrwN/I cfUA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691863290; x=1692468090; 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=GVQXDzRYxjdJHzzISXJha/R1/7+5Jp/aJX0MK8+MVhg=; b=CeHo51RIV0sSy/2HWTBF3+E44mQKDi9iJPwfzulSxAH//afDum1CFPDAfQkrvXvHzW HCKvGOtOEO1to3v/yDVutJMtGh9Zu3FyOrbAUkcQq+nwmGwCiNuAGLfx0A2ZMDL2GZCS XZc5mOYWPVpqzOy5HHmPdIjssYw5n6L0ooyNgiNBL6z+lxalNWlvyPJ8QI3IA39CHHaD rhCf90v6PzzJhn+Y1PgxWurOkUkApCeOMlvcCz8dtpSxhfhfd+DlEwU4t6mTf+GMqnfv eRVfkFAXZO5afJGQ0R76ptxrBrfct4yCSP8+Ou7D/lxzkjXl8YL5FqTR8pS1m0zGOq3l q9jA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691863290; x=1692468090; 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=GVQXDzRYxjdJHzzISXJha/R1/7+5Jp/aJX0MK8+MVhg=; b=RlzfI4TUQNc9ehg/fbMOe71/lKANU3OYGOA0x/WsGS43uwyk1zO+BKVDCw2h/ZJjtB zUJfiUy66BniG0rrM0vtan10VxvLJZU+Km90Ly6AJ/00CdAnsVe8kKpS01Wucn0nsTJ4 JNS+W7bRiyvQowJAziFuSSLCfAt3G20MS9tJRX5L2oBCi2ZOnMXbhIeF2srVq9eOVLCu /2o0KfaDleaQvM70TdhrrMBD4SIBNnJyRajg3r87hIDF8vldp8qtc3T+/UfnclE3nAlm Rdwhkmhxj2JTxEsPN0sz+q8XzhMB31PuG6c863hQPzrzn/4NUp Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOJu0Yx4Qq54Zy7uL9UzA221kkoC6G82sogSv9K2GxW58YQupxnBjqW/ B6gln9EyXSDbroREhoWMl04= X-Google-Smtp-Source: AGHT+IHngRfY5kmoOk+L8d07Q/Ne7xKxlr1A+KVN6lo/i0oxqwAwPcWOW54KYhw82XZFA8MaNSKS/A== X-Received: by 2002:a17:902:dad1:b0:1bb:a941:d940 with SMTP id q17-20020a170902dad100b001bba941d940mr4597308plx.15.1691863290462; Sat, 12 Aug 2023 11:01:30 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a17:902:6e17:b0:1bd:c972:493a with SMTP id u23-20020a1709026e1700b001bdc972493als420695plk.2.-pod-prod-01-us; Sat, 12 Aug 2023 11:01:26 -0700 (PDT) X-Received: by 2002:a17:903:2452:b0:1b8:5541:9d4d with SMTP id l18-20020a170903245200b001b855419d4dmr2148189pls.6.1691863285947; Sat, 12 Aug 2023 11:01:25 -0700 (PDT) In-Reply-To: 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:33049 Archived-At: ------=_Part_13845_1435423618.1691863285128 Content-Type: multipart/alternative; boundary="----=_Part_13846_474701935.1691863285128" ------=_Part_13846_474701935.1691863285128 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable $ pandoc -t native ![SVG Image](data:image/svg+xml;charset=3Dutf-8, width=3D"100" height=3D"100" viewBox=3D"-150 -= 150=20 300 300">) [ Figure ( "" , [] , [] )=20 (Caption Nothing [ Plain [ Str "SVG" , Space , Str "Image" ] ]) [ Plain [= =20 Image ( "" , [] , [] ) [ Str "SVG" , Space , Str "Image" ] (=20 "data:image/svg+xml;charset=3Dutf-8,%3C?xml%20version=3D%221.0%22?%3E%3Csvg= %20xmlns=3D%22http://www.w3.org/2000/svg%22%20width=3D%22100%22%20height=3D= %22100%22%20viewBox=3D%22-150%20-150%20300%20300%22%3E%3Crect%20x=3D%22-100= %22%20y=3D%22-100%22%20rx=3D%228%22%20ry=3D%228%22%20width=3D%22200%22%20he= ight=3D%22200%22%20style=3D%22fill:#CCCCFF;stroke:#000099%22/%3E%3C/svg%3E"= =20 , "" ) ] ] ] Le samedi 12 ao=C3=BBt 2023 =C3=A0 19:59:59 UTC+2, Christophe Demko a =C3= =A9crit : > It's because pandoc converts the URL of an image using HTML encoding and= =20 > does not the reverse job while producing output. > > Le samedi 12 ao=C3=BBt 2023 =C3=A0 19:42:38 UTC+2, nopria a =C3=A9crit : > >> Yes it's an option, but I would like to understand why using plain text= =20 >> does not work. >> >> Il giorno venerd=C3=AC 11 agosto 2023 alle 12:23:32 UTC+2 Christophe Dem= ko ha=20 >> scritto: >> >>> You could write a filter that convert a Inline SVG image defined by=20 >>> plain 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 conver= t to=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 image= s. >>>> >>>> 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"=20 >>>> viewBox=3D"-150 -150 300 300">>>> width=3D"200" 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+PHN2ZyB4b= Wxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAw= IiB2aWV3Qm94PSItMTUwIC0xNTAgMzAwIDMwMCI+PHJlY3QgeD0iLTEwMCIgeT0iLTEwMCIgcng= 9IjgiIHJ5PSI4IiB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCIgc3R5bGU9ImZpbGw6I0NDQ0NGRj= tzdHJva2U6IzAwMDA5OSIvPjwvc3ZnPg=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 SV= G=20 >>>> is correctly converted, while the textual inline SVG is not displayed = in=20 >>>> the 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= =20 >>>> to 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 com= plex=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/97837349-aaf9-419d-98ca-e793c96beef1n%40googlegroups.com. ------=_Part_13846_474701935.1691863285128 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

<= span style=3D"font-family: Consolas, Inconsolata, Courier, monospace; margi= n: 0px 0.15em; font-weight: 550; white-space: pre; overflow: auto; border-r= adius: 3px; border: 1px solid rgb(204, 204, 204); padding: 0.5em 0.7em; dis= play: block; background: rgb(255, 255, 255); color: rgb(0, 0, 0);">$ pandoc -t native ![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"><rect x=3D"-100" y=3D"-100" rx=3D"8" ry=3D"8" width=3D"200" hei= ght=3D"200" style=3D"fill:#CCCCFF;stroke:#000099"/></svg>) [ Figure ( "" , [] , [] ) (Caption Nothing [ Plain [ Str "SVG" , Space , Str "Image" ] ]) [ Plain [ Image ( "" , [] , [] ) [ Str "SVG" , Space , Str "Image" ] ( "data:image/svg+xml;charset=3Dutf-8,%3C?xml%20version=3D%2= 21.0%22?%3E%3Csvg%20xmlns=3D%22http://www.w3.org/2000/svg%22%20width=3D%221= 00%22%20height=3D%22100%22%20viewBox=3D%22-150%20-150%20300%20300%22%3E%3Cr= ect%20x=3D%22-100%22%20y=3D%22-100%22%20rx=3D%228%22%20ry=3D%228%22%20width= =3D%22200%22%20height=3D%22200%22%20style=3D%22fill:#CCCCFF;stroke:#000099%= 22/%3E%3C/svg%3E" , "" ) ] ] ]

Le samedi 12 ao=C3=BBt 2023 =C3=A0 19:59:59 UTC+2, Christ= ophe Demko a =C3=A9crit=C2=A0:
It's because pandoc converts the URL of an image usin= g HTML encoding and does not the reverse job while producing output.
Le samed= i 12 ao=C3=BBt 2023 =C3=A0 19:42:38 UTC+2, nopria a =C3=A9crit=C2=A0:
Yes it's an option, but= I would like to understand why using plain text does not work.

Il giorno ven= erd=C3=AC 11 agosto 2023 alle 12:23:32 UTC+2 Christophe Demko ha scritto:
You could write a filte= r that convert a Inline SVG image d= efined by plain text into a = Inline SVG image defined by BASE64

Le jeudi 10 ao=C3=BBt 2023 =C3=A0 1= 5:39:40 UTC+2, nopria a =C3=A9crit=C2=A0:
Following other te= ntatives of markdown to DOCX conversion containing external SVG, I trie= d to convert to ODT a markdown containing **inline** SVG, such as the one b= elow:

# Example= document

This is an example of Markdown document with inline embedd= ed SVG images.

Inline SVG image 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"><rect x=3D"-100" y=3D"= ;-100" rx=3D"8" ry=3D"8" width=3D"200" h= eight=3D"200" style=3D"fill:#CCCCFF;stroke:#000099"/>= ;</svg>)

Inline SVG image defined by BASE64 converted text:
![SVG Image](data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+PHN= 2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD= 0iMTAwIiB2aWV3Qm94PSItMTUwIC0xNTAgMzAwIDMwMCI+PHJlY3QgeD0iLTEwMCIgeT0iLTEwM= CIgcng9IjgiIHJ5PSI4IiB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCIgc3R5bGU9ImZpbGw6I0ND= Q0NGRjtzdHJva2U6IzAwMDA5OSIvPjwvc3ZnPg=3D=3D)

Some math to check if = it works;

$$A_c =3D 23 r^2 - v$$
<= div>
using command

pandoc example.md -o example.odt
with Pandoc 3.1.6.1. As you may confirm yourself, the BASE64 i= nline SVG is correctly converted, while the textual inline SVG is not displ= ayed in the resulting ODT and the following warning appears at conversion:<= /div>

[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 avoid the BASE64 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/97837349-aaf9-419d-98ca-e793c96beef1n%40googlegroups.= com.
------=_Part_13846_474701935.1691863285128-- ------=_Part_13845_1435423618.1691863285128--