From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/33048 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 10:59:59 -0700 (PDT) Message-ID: 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_19216_892971004.1691863199241" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12118"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDN5TJEC4AEBBIER36TAMGQE4HDZCWQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sat Aug 12 20:00:06 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-pf1-f185.google.com ([209.85.210.185]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1qUsuD-0002yx-NB for gtp-pandoc-discuss@m.gmane-mx.org; Sat, 12 Aug 2023 20:00:05 +0200 Original-Received: by mail-pf1-f185.google.com with SMTP id d2e1a72fcca58-686baf1a407sf3730166b3a.1 for ; Sat, 12 Aug 2023 11:00:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20221208; t=1691863204; x=1692468004; 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=M7zzimUiQuZpVDB2bUIOpP7Kj89+8cx2bC6EgcUilx4=; b=tRI6NVKaAievHhJpFcZZv0bADTRsyMzX3Wzw6tI2jGB971lTnJyZ8P/njkXqlhtYx9 B7T9cWeRlIOzy8kOcFWoJHpRpinade2Iat6FZvktGWeNbUkcmtzoBBfHo/LsTLjGrOjD JryogAo8lXiqGbkA2htEMdLVNQrXOFsItO3p/cYyHADiLnkVQmjMYL3F18tDT5kjkJ2v zMG0tPatxP6GFjhM51ZM8GAV9gAh8Z2iBOn2ydWD7zeoDKOkWZdZGLHiMqoqeS+5E2gJ 07WtSGttj6Zq6PMH3J8eHHpT7YmL0wCjlg8Ixm/WgYFjBa7vBV6TPyPfNdh52oXzxOs4 vqdw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691863204; x=1692468004; 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=M7zzimUiQuZpVDB2bUIOpP7Kj89+8cx2bC6EgcUilx4=; b=JUsXe9Kz5hmPyQ951D3tmPM974UPd+zxV/X4oidAHZ5DU+iV0hrf5ZHIdAIUdaaUw+ TVicURUZoSj+5c167QSnfA5aa8jede+5hiAQJ+Qce8/gfSh9LXp3JJsQm0yRSS701Vev UiEaq4m4SzkWt/b114k6PpJnXfDzcj8mWOxED2qqRTB/nb/0I9Q5jD2++r7zO2YTCB/K NuL1Ae5/MdVzNuPHim4Qm3E7krpbZvcKmXUepylQM1oWawe1zU6C4USmRYRvih5v1wJr cBwAKJABJCqP+TNk+Cf2Cku/c7IDs4uTli7KMEvyTaKV8FIqjERVqk0T/PAt/EZm7Sh2 ErFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691863204; x=1692468004; 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=M7zzimUiQuZpVDB2bUIOpP7Kj89+8cx2bC6EgcUilx4=; b=KBGeWyS99EeQDphv35Dg+g1RavdNiQS61P5Xaj03mhWsWFQlfygPvouH0RCpiRvc6n W3wWDmVHD3ca3BhBO8/7P4gE5hEKUOJQnHzYLtCTK9ZmIx6AgkId5ql2UY7bIJ2grogw Vm0oAf3xjtbAwUOts5adl4ZKQRptor1e4w9pcruHujRXBO5oPgi6O64qPJkwHQGGRg50 slE2otxLxyR0CePmqRcFORpCnc1xlu0hnjpJZPESNpmrw/KLvA6Hf1n8AoqhtZwCMa0u pmRoodGHAkMSj1t5+4H2bjK0okSHzxaUqmMM3YdJttpJUmoYx/ Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOJu0YypGY9jhptZ7X45HjBcE00DWI8WndNB0OdAf1HcAvBc4XZdZRR4 MqTAUr2vz7YVM3MbEKVRsMI= X-Google-Smtp-Source: AGHT+IFOSYzgKQGSp7qYLrIduE1GTiUB1JorwlfvyyVmnOxu7L90B7SV/7ySq0Z8WQsmdd/wwrOI8A== X-Received: by 2002:a05:6a00:983:b0:67f:830f:b809 with SMTP id u3-20020a056a00098300b0067f830fb809mr7069034pfg.3.1691863203900; Sat, 12 Aug 2023 11:00:03 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a62:7956:0:b0:687:c50c:d143 with SMTP id u83-20020a627956000000b00687c50cd143ls2669939pfc.2.-pod-prod-02-us; Sat, 12 Aug 2023 11:00:00 -0700 (PDT) X-Received: by 2002:a63:3e47:0:b0:564:bab6:24b4 with SMTP id l68-20020a633e47000000b00564bab624b4mr1055006pga.4.1691863199913; Sat, 12 Aug 2023 10:59:59 -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:33048 Archived-At: ------=_Part_19216_892971004.1691863199241 Content-Type: multipart/alternative; boundary="----=_Part_19217_1623181429.1691863199241" ------=_Part_19217_1623181429.1691863199241 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 Demk= o 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 convert= 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 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"=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+PHN2ZyB4bW= xucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwI= iB2aWV3Qm94PSItMTUwIC0xNTAgMzAwIDMwMCI+PHJlY3QgeD0iLTEwMCIgeT0iLTEwMCIgcng9= IjgiIHJ5PSI4IiB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCIgc3R5bGU9ImZpbGw6I0NDQ0NGRjt= zdHJva2U6IzAwMDA5OSIvPjwvc3ZnPg=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= =20 >>> is correctly converted, while the textual inline SVG is not displayed i= n=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 comp= lex=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/fe366afd-808e-4356-a328-9892b6c8b136n%40googlegroups.com. ------=_Part_19217_1623181429.1691863199241 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable It's because pandoc converts the URL of an image using HTML encoding and do= es not the reverse job while producing output.

Le samedi 12 ao=C3=BBt 202= 3 =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 venerd=C3=AC= 11 agosto 2023 alle 12:23:32 UTC+2 Christophe Demko ha scritto:
<= blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 0.8ex;border-left:1p= x solid rgb(204,204,204);padding-left:1ex">You could write a filter that co= nvert a Inline SVG image defined by= plain text into a Inline SV= G 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/fe366afd-808e-4356-a328-9892b6c8b136n%40googlegroups.= com.
------=_Part_19217_1623181429.1691863199241-- ------=_Part_19216_892971004.1691863199241--