From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/33052 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: Sun, 13 Aug 2023 08:45:56 -0700 (PDT) Message-ID: <56d7ca33-74ad-4499-8cb1-49e8ea240187n@googlegroups.com> References: <3ed4f0e5-ad35-4aaa-81c8-4e5766b88896n@googlegroups.com> <181d94a6-f783-45a6-8d93-284a6674b977n@googlegroups.com> <97837349-aaf9-419d-98ca-e793c96beef1n@googlegroups.com> <571445b9-922a-4dd8-8228-d3a3ad445e55n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_7340_215594921.1691941556372" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40168"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDN5TJEC4AEBBNXV4OTAMGQEZGSNQHA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sun Aug 13 17:46:04 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-pf1-f191.google.com ([209.85.210.191]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1qVDI3-000ADd-CZ for gtp-pandoc-discuss@m.gmane-mx.org; Sun, 13 Aug 2023 17:46:03 +0200 Original-Received: by mail-pf1-f191.google.com with SMTP id d2e1a72fcca58-686c06b8011sf4074583b3a.2 for ; Sun, 13 Aug 2023 08:46:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20221208; t=1691941562; x=1692546362; 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=y8fgnYwECDhLpYavSGlFxaI6yFn/1ThsIGV5cU1Vu74=; b=qtAUVo2K26EHbBFLtgRiFJ6XlscZPuqnf+G/t6AuCHNxkLEp724Cunz3sYe2UMNPJc PRzWiz/kAFf4GOoh6sFJusFgynSJphVdbB4qoRpjPeN+n7qLffxklR9/7sSLbnksUTdJ VyUsMrKIHQuFYz2GaxQ7j6nIjhRqBxxTMTzdm4gLcvvgXyB6j/KQ7xyZs+SIbqFx+6Jh xZOlMwKZUZcSZXzlXwLXFG3RJP/T1d59uqb5CdxviFam4H6gvZtOOCM3t6qh+TwexjzB Ju8goVBHwoos3quVEo1wWfQDccN9HtmoMLdd2xcnQ+4fj+I6VNTxJCoGgOGg3E8veuob rlew== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691941562; x=1692546362; 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=y8fgnYwECDhLpYavSGlFxaI6yFn/1ThsIGV5cU1Vu74=; b=dYb+oo7QQUySW7CBWWo/kCGaysbYtNvCEekR8zsXTsaDkYGJjbcMsBLgbZdXw2rfXO bmWSveOoBv9LecNVtEXNmUbMVlWUWfDxyi7VncH43LnInBq8CWJH+5spDcbiUl96FbVv AcG9IPXfS+L6gYkdX60RH0BV72Jxsq7+YWPzJh6Ni5d/LzrVhGGbi1HpMhCEW4I/DkdI qo3iHzupcABOwc1bkv9Fk1qAgBcJeo6nFUaaa1AWkDbaz+GegglRW/ODYe/ihY8XP2oF f33FyhLWdTMmaXHRl0EPh5ZFzPK9v6E8OFQy2jaO47+qJFpo1xmpSY31LA36tNL+EOVo rLFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691941562; x=1692546362; 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=y8fgnYwECDhLpYavSGlFxaI6yFn/1ThsIGV5cU1Vu74=; b=U0Du8/vA2k2JDwLTStcUoKyn+8syDcVIhvo2KRiS0Gl7B5y9H+7yVrgP5VKT2fhTAy TIyVmK9mqwPoelEmP/fsqWJEv3Lxpad6W7oE4aKwQrX9XK7ZjYVRQm0uTqbO7F36whqh 3NiBM+xE7hWWJREF9Y+E4bP0YvmN/7DS1dUsBXyuHFUfY4vWwZNMf945lKS/vwa2J0gk 66INh+Wikgjazaa1BNooc0ctkCSmd5dNhkKW8/AOO4M/uj8s0+SvraStLePBdFKe8aew xmnTeVK7yXhnZDEyGKVuQFM14V+loalwc84QW4neP0wfjoGpqg Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOJu0Yws4w7UU9QmVxVIkwvFqQHGtjeU4MEDVhYzIeS0IMBNgOxxHHdj ZrnDYd7Ct8x2uesLGA/B+FM= X-Google-Smtp-Source: AGHT+IHuqe/08VqR8yiaZHiRs+VdQ1aeEiyWs0fCJT/7rQYtDwQykjbsimopJS3B+KTcwcixUtMaPg== X-Received: by 2002:a05:6a00:a11:b0:682:f48a:7295 with SMTP id p17-20020a056a000a1100b00682f48a7295mr8757049pfh.31.1691941561973; Sun, 13 Aug 2023 08:46:01 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:aa7:8f31:0:b0:668:7511:1552 with SMTP id y17-20020aa78f31000000b0066875111552ls3216234pfr.1.-pod-prod-09-us; Sun, 13 Aug 2023 08:45:57 -0700 (PDT) X-Received: by 2002:a05:6a00:2488:b0:67d:41a8:3e19 with SMTP id c8-20020a056a00248800b0067d41a83e19mr3263566pfv.3.1691941557270; Sun, 13 Aug 2023 08:45:57 -0700 (PDT) In-Reply-To: <571445b9-922a-4dd8-8228-d3a3ad445e55n-/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:33052 Archived-At: ------=_Part_7340_215594921.1691941556372 Content-Type: multipart/alternative; boundary="----=_Part_7341_1345430913.1691941556372" ------=_Part_7341_1345430913.1691941556372 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I don't know, only John MacFarlane can have the answer to that question Le dimanche 13 ao=C3=BBt 2023 =C3=A0 07:38:44 UTC+2, nopria a =C3=A9crit : > 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"-15= 0 -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%3C= svg%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 an= d=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 tex= t=20 >>>> does not work. >>>> >>>> Il giorno venerd=C3=AC 11 agosto 2023 alle 12:23:32 UTC+2 Christophe D= emko=20 >>>> ha 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 >>>>>> = =20 >>>>>> of markdown to DOCX conversion containing external SVG, I tried to c= onvert=20 >>>>>> to 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:#= 000099"/>) >>>>>> >>>>>> Inline SVG image defined by BASE64 converted text: >>>>>> >>>>>> ![SVG=20 >>>>>> Image](data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+PHN2ZyB= 4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMT= AwIiB2aWV3Qm94PSItMTUwIC0xNTAgMzAwIDMwMCI+PHJlY3QgeD0iLTEwMCIgeT0iLTEwMCIgc= ng9IjgiIHJ5PSI4IiB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCIgc3R5bGU9ImZpbGw6I0NDQ0NG= RjtzdHJva2U6IzAwMDA5OSIvPjwvc3ZnPg=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 disp= layed=20 >>>>>> in the resulting ODT and the following warning appears at conversion= : >>>>>> >>>>>> [WARNING] Could not fetch resource data:image/svg+xml;charset=3Dutf-= 8=20 >>>>>> ... >>>>>> >>>>>> Given that a BASE64 inline SVG is enough to do the job, I would=20 >>>>>> prefer to avoid the BASE64 conversion and go with the plain text inl= ine SVG. >>>>>> >>>>>> I already tried html encoding of SVG text and uppercase "utf8"=20 >>>>>> without 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 c= omplex=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/56d7ca33-74ad-4499-8cb1-49e8ea240187n%40googlegroups.com. ------=_Part_7341_1345430913.1691941556372 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I don't know, only John MacFarlane can have the answer to that = question

Le dimanche 13 ao=C3=BBt 2023 =C3=A0 07:38:44 UTC+= 2, nopria a =C3=A9crit=C2=A0:
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 h= a scritto:

$ 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" 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/56d7ca33-74ad-4499-8cb1-49e8ea240187n%40googlegroups.= com.
------=_Part_7341_1345430913.1691941556372-- ------=_Part_7340_215594921.1691941556372--