From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/33051 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: nopria Newsgroups: gmane.text.pandoc Subject: Re: Inline SVG in markdown, converted to ODT Date: Sat, 12 Aug 2023 22:38:44 -0700 (PDT) Message-ID: <571445b9-922a-4dd8-8228-d3a3ad445e55n@googlegroups.com> References: <3ed4f0e5-ad35-4aaa-81c8-4e5766b88896n@googlegroups.com> <181d94a6-f783-45a6-8d93-284a6674b977n@googlegroups.com> <97837349-aaf9-419d-98ca-e793c96beef1n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_2662_215615568.1691905124214" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="402"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDKOFYFD3MCRBZOY4GTAMGQEENMBYWI-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sun Aug 13 07:38:52 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-pf1-f184.google.com ([209.85.210.184]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1qV3oR-000AVz-D2 for gtp-pandoc-discuss@m.gmane-mx.org; Sun, 13 Aug 2023 07:38:51 +0200 Original-Received: by mail-pf1-f184.google.com with SMTP id d2e1a72fcca58-686e7b27f55sf4161030b3a.2 for ; Sat, 12 Aug 2023 22:38:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20221208; t=1691905130; x=1692509930; 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=EqWBjSvTDOdp5NLZZH3ebbDkE4tHz7X0eEgTwp/Uvzs=; b=mgZX7jjm9LxRFFMlQZ7jVUfXfPrMCuP1vo7Wg7klVTmnEJH/XC0X7/vyqCUuYLSBaJ sB0mlTVHUCOFTs7aSGO8h+CMeKvAwbOutKynpGbzvbsrSW4rb5fm39JanK0JtrB/rQMk wOFupEv+TWk9NzXTnsK2LfKeqursqRKab0B7nxb8EjdX2+d9rj3Mf/owsBppZtaGzk6R Wg4ea3wNkRnZX7X/RAC6Ndkv1h575+Z+3SZQ/bUVEY5CHwy2de2nsZ02/B3zixbrDaLM 7Bm1Mdzl224UMRbkVgh0gNDs6Du6Zn/m1UATFxj9xPQP0fJapM+UiGwuecGFFs6WYMaE MoCg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691905130; x=1692509930; 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=EqWBjSvTDOdp5NLZZH3ebbDkE4tHz7X0eEgTwp/Uvzs=; b=ew9we92lvMcbMLTuoA8qT0VawOeTeaLFgICKrDC3h6a5vFjT+ySCVjbbeCGwX8SO7F +LTW5efc0kSo7sCxttQ6wjXW6i4rB6BXqJQy5efQjQHam7o8GMfNIgSuDXAQPU9iTnRb HYVcfn1dN6JbdQfVBzgmK0kBRvUXajOe2WJhBlH9P8yaeyYZlUxauPhgLAAgCEcP03+v nU8CxwG9RqR00ydulH0u5vHGuqaptvEiWOE4KQMejIqsXNAtKVxQOkDwwOtJs5bVCAcy 46X22v4Zm5+aMgnXyfq9/NJvBPCGIlBWIVtoEXvXi25RbJ2aar9CuE6cU24mNgA0VmHq nJpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691905130; x=1692509930; 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=EqWBjSvTDOdp5NLZZH3ebbDkE4tHz7X0eEgTwp/Uvzs=; b=j2cwvusgdXxZbo7nncW1P5D5ilFGb3qj26/qMX150h6Ilvsy/Ar75FT4xNNPwRIRd8 +Ky7EhZx9JbMez4UrapuCUk2ielH5hbJ4QKUASR7xTxZ1cnQRHkqRioEEBDzetyciCeL lgSz8xewbeCjicdg/UbFtxdVxhDPdp0IL99zKGcrWl9wL9ouuUaax+I9kRtN+EL59aun UjhHdzpTY+GguMsNf5NsZDeTARaMOGv/3HCPhq/UQPmkLolnJt4sPD5yFlL3fzwDFxN0 96W+YB57R3IFrmJhqGPbJyC65g9IjSw9p/7R36+Z4nrHHfNbLz Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOJu0Ywl/N3RySVpioZjPDQ0WGiBcFaJf9KAUmYHbUM2NR8mXWPw9nkJ p3IsX6rysKM08ZTbXwJtggQ= X-Google-Smtp-Source: AGHT+IFzWFdCXxyhGvlchrl3j9YLO1n3RYn/eVw5JrY0WaHySWP70erlhT09Q4LjfLwcSHrBwImc+w== X-Received: by 2002:a05:6a21:4995:b0:13f:52f1:fe66 with SMTP id ax21-20020a056a21499500b0013f52f1fe66mr5339074pzc.19.1691905129787; Sat, 12 Aug 2023 22:38:49 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:aa7:9633:0:b0:668:732c:5466 with SMTP id r19-20020aa79633000000b00668732c5466ls3184918pfg.0.-pod-prod-07-us; Sat, 12 Aug 2023 22:38:45 -0700 (PDT) X-Received: by 2002:a63:7b52:0:b0:564:538f:5683 with SMTP id k18-20020a637b52000000b00564538f5683mr1141097pgn.4.1691905125117; Sat, 12 Aug 2023 22:38:45 -0700 (PDT) In-Reply-To: <97837349-aaf9-419d-98ca-e793c96beef1n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Original-Sender: lisprule-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:33051 Archived-At: ------=_Part_2662_215615568.1691905124214 Content-Type: multipart/alternative; boundary="----=_Part_2663_316578471.1691905124214" ------=_Part_2663_316578471.1691905124214 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I see, can such behaviour be fixed? Should I report it as a bug? Il giorno sabato 12 agosto 2023 alle 20:01:25 UTC+2 Christophe Demko ha=20 scritto: > > $ pandoc -t native ![SVG Image](data:image/svg+xml;charset=3Dutf-8, version=3D"1.0"?> width=3D"100" height=3D"100" viewBox=3D"-150= -150=20 > 300 300"> style=3D"fill:#CCCCFF;stroke:#000099"/>) [ 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%3Cs= vg%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%2= 0height=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 De= mko 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 conve= rt 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=20 >>>>> images. >>>>> >>>>> Inline SVG image defined by plain text: >>>>> >>>>> ![SVG Image](data:image/svg+xml;charset=3Dutf-8,>>>> version=3D"1.0"?>>>>> height=3D"100" viewBox=3D"-150 -150 300 300">>>>> ry=3D"8" width=3D"200" height=3D"200" style=3D"fill:#CCCCFF;stroke:#0= 00099"/>) >>>>> >>>>> Inline SVG image defined by BASE64 converted text: >>>>> >>>>> ![SVG=20 >>>>> Image](data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+PHN2ZyB4= bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMTA= wIiB2aWV3Qm94PSItMTUwIC0xNTAgMzAwIDMwMCI+PHJlY3QgeD0iLTEwMCIgeT0iLTEwMCIgcn= g9IjgiIHJ5PSI4IiB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCIgc3R5bGU9ImZpbGw6I0NDQ0NGR= jtzdHJva2U6IzAwMDA5OSIvPjwvc3ZnPg=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= =20 >>>>> SVG is correctly converted, while the textual inline SVG is not displ= ayed=20 >>>>> in 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 prefe= r=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" withou= t=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 co= mplex=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/571445b9-922a-4dd8-8228-d3a3ad445e55n%40googlegroups.com. ------=_Part_2663_316578471.1691905124214 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I see, can such behaviour be fixed? Should I report it as a bug?

Il giorn= o sabato 12 agosto 2023 alle 20:01:25 UTC+2 Christophe Demko ha scritto:

=
$ pandoc -t nati= ve ![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" he= ight=3D"100" viewBox=3D"-150 -150 300 300"><rect = x=3D"-100" y=3D"-100" rx=3D"8" ry=3D"8&q= uot; width=3D"200" height=3D"200" style=3D"fill:#C= CCCFF;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%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%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, Christop= he Demko a =C3=A9crit=C2=A0:
It's because pandoc converts the URL of an image using HTML enco= ding and 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=C2=A0:
Yes it's an option, but I would l= ike to understand why using plain text does not work.

Il giorno venerd=C3=AC = 11 agosto 2023 alle 12:23:32 UTC+2 Christophe Demko ha scritto:
You could write a filter that con= vert a Inline SVG image defined by = plain text into a Inline SVG= image defined by BASE64

Le jeudi 10 ao=C3=BBt 2023 =C3=A0 15:39:40 U= TC+2, nopria a =C3=A9crit=C2=A0:
Following other tentative= s of markdown to DOCX conversion containing external SVG, I tried to co= nvert to ODT a markdown containing **inline** SVG, such as the one below:

# Example docume= nt

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,<?xml version=3D"1.0"?>&= lt;svg xmlns=3D"http://www.w3.org/2000/= svg" width=3D"100" height=3D"100" viewBox=3D&q= uot;-150 -150 300 300"><rect x=3D"-100" y=3D"-100= " rx=3D"8" ry=3D"8" width=3D"200" height= =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+PHN2ZyB4= bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMTA= wIiB2aWV3Qm94PSItMTUwIC0xNTAgMzAwIDMwMCI+PHJlY3QgeD0iLTEwMCIgeT0iLTEwMCIgcn= g9IjgiIHJ5PSI4IiB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCIgc3R5bGU9ImZpbGw6I0NDQ0NGR= jtzdHJva2U6IzAwMDA5OSIvPjwvc3ZnPg=3D=3D)

Some math to check if it wo= rks;

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

pandoc example.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:image/svg+xml;charset=3Dutf-8 ...

Given that a BASE64 inline SVG is enough to do the job, I w= ould 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/571445b9-922a-4dd8-8228-d3a3ad445e55n%40googlegroups.= com.
------=_Part_2663_316578471.1691905124214-- ------=_Part_2662_215615568.1691905124214--