From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id OMWgFj8O2mVHPAAAe85BDQ:P1 (envelope-from ) for ; Sat, 24 Feb 2024 16:41:51 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id OMWgFj8O2mVHPAAAe85BDQ (envelope-from ) for ; Sat, 24 Feb 2024 16:41:51 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=St5EXtdS; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1708789311; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=gf8xaV0oYgjrHmdesc5gZOjvtUEpGG546Xc41bqJ+Xg=; b=PLpS2p01p2oDsZXIXh639hEVVfnAAymx3DbcZ+j+X9f5urbZ4K1t/09F6EsENUHqupWQw9 ghaaf20oJ17/jz3QxhN7V57pAbYbA/OavLXkhO/AaAjFKivWSzCMf1xCsb0DMuVwr7/QTU tkHNcBT/LZ7sCN+4mraiQ/FEcYMl6sMmqirYhkd6nd8fQBx9y7esxZUYbwBm7jb1Q9Y4fN 0LDq8k+1WZtSaO5ULiffv21B2XrN9jJ+yBqSIM5bVtx6B0s+fKmh4vTjekWW2/eVLFVLgP FoWdtllI1ctUmRVkUfBWSeGzqNmVbLvUHheltM+nzqlYRNhBRKeaR2XzPmbp9Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=St5EXtdS; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=key1; d=yhetil.org; t=1708789311; a=rsa-sha256; cv=none; b=AADJEYEzsF2V990te6JgD65VtGBB3S1zZEQP/NMEkFS3bziVi+DK4xfCWol95M0+ukno0/ 1wTyHWcNYcstkJh5g8dzP1D1EMo89kHj8sGrlifPLLdEzmGmY/qmKIR1/NbbApTMHJCCPV 9Ec4Wp5KjQuRCQGWCLFNPTAnuCzUfNKL4vzwzm8rddXN3JGIYJTzbBBo6nG3z++6HAJqO1 lDqCESPLTKqmGQ61gnki8rhdPGIN6gjkyHX4ABlbTNt97589rFZbe03UBLcr3E5GGLJO0Z oseSJcMsLnuD5dsSmBq3zcTFiU2JNbxs7Ye2FXToBR52obbB5m4P2YpfhC8/CQ== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 1E8AF24D1B for ; Sat, 24 Feb 2024 16:41:51 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdu8M-0004KR-8a; Sat, 24 Feb 2024 10:40:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rcoXY-0003zj-Tz for emacs-orgmode@gnu.org; Wed, 21 Feb 2024 10:29:44 -0500 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rco2r-0007Vd-4G for emacs-orgmode@gnu.org; Wed, 21 Feb 2024 09:58:02 -0500 Received: by mail-wm1-x342.google.com with SMTP id 5b1f17b1804b1-412698ac6f9so17481255e9.0 for ; Wed, 21 Feb 2024 06:58:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708527478; x=1709132278; darn=gnu.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=gf8xaV0oYgjrHmdesc5gZOjvtUEpGG546Xc41bqJ+Xg=; b=St5EXtdSwoekXAL+ceHTKRgHgfd4ZkEYBvoVNwfFY6GiBvbGAhTEjqkAYNCms/qTJR pHIvclZSXpR15KrqGIJYDQpQsIbirLxa9fAeX2oB+gnjP1EneX5j6BG8YBTD5xza9TTW UGwMfgjeeOyT7yexDOdVfjDszmH3B/LoO1N8Fm6UtLSN1aJGW9bH5IkHCsB/UF2EmxGy JfXwi6mZCdnQVXODpaUdu4QfHXDE1zft+LXvgb5sf4p3rxcgHBb/2kPl0PBScag8muMo nZP5IQYHXoKa12nSl24JylMgCCyOrkECYj8OBftiy73pbMrcKapfuA65wW+JItwPFU79 6RXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708527478; x=1709132278; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=gf8xaV0oYgjrHmdesc5gZOjvtUEpGG546Xc41bqJ+Xg=; b=I+t7zS1IR+x9QbvidFjz8oPSgkt5f6Qkpn6BmNWaqoEBGFmool6mvfSjMQazUf9NCB lgqTFJLB9CNNIhLcPg5GpsQ1Q9tT4UdzHs4mswldi0rlxIWtLsPQ7jy0eFsyWye2wzMZ WlfAy59dJnOq12qqTgfkMJXtsCvu2qn4tV7mDMEydk/4kW6Cm33bxSLZDDAurZ64X0/V ljLs/0TFj/MvWdErW5sebqCR52iuJgRdOxN/3TfwmExmeXF9/YPYId2PM7l66Di5vxP8 VO8RT07yeOVjAAcDiZuqUM1xNnbL6FSf5cdRnZK5wlYslSo50biqrrhqO84Sbep+gHtV n7PA== X-Forwarded-Encrypted: i=1; AJvYcCX70IKLtYJaE+Xh6Itl7kW313f7GS87+y4mFDabUw3nkViRirbYDnKZQ6osE6X0TM7mLTszNMa0mhXF1C34jWRAdh+4SNc= X-Gm-Message-State: AOJu0YzPuqOhdO9AhPmrpScP6HoCvH4nu+BFnNs5z05fvrHHdv2NAXkE 8Su5+5U4VjjTJIrNXsT2Mggg8BJqytmiAshq7Q1r+XHgytPBoaLR7AzwDrOeW/gEHrZ8AaEFpjb nqb3txgWT0HZVTNx+lQPu7YSdpDM= X-Google-Smtp-Source: AGHT+IH1K971QMDi5i+4/dz584czNSUdraSwGuJIYeBeeWLELCvgQCSQi6Dqaf9pUUjozkfBuk/d3Mu55dt3EwIQnKo= X-Received: by 2002:a05:600c:190e:b0:410:78fb:bed2 with SMTP id j14-20020a05600c190e00b0041078fbbed2mr17077560wmq.19.1708527478044; Wed, 21 Feb 2024 06:57:58 -0800 (PST) MIME-Version: 1.0 References: <87wmr1rc2w.fsf@localhost> In-Reply-To: From: =?UTF-8?Q?Martin_Edstr=C3=B6m?= Date: Wed, 21 Feb 2024 15:57:47 +0100 Message-ID: Subject: Re: Warn about shell-expansion in the docstring of org-latex-to-html-convert-command To: =?UTF-8?Q?Martin_Edstr=C3=B6m?= , emacs-orgmode@gnu.org Content-Type: multipart/alternative; boundary="0000000000006afcbc0611e58d2a" Received-SPF: pass client-ip=2a00:1450:4864:20::342; envelope-from=meedstrom91@gmail.com; helo=mail-wm1-x342.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sat, 24 Feb 2024 10:40:05 -0500 X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -6.70 X-Spam-Score: -6.70 X-Migadu-Queue-Id: 1E8AF24D1B X-TUID: NI+3/+AMnFYH --0000000000006afcbc0611e58d2a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Ah yes. My custom Node script (which I hope it's OK to paste below) strips the beginnings and ends of the input. I suppose that it could be done already on the Elisp side, which would take care of interpreting the $-signs as envvars too. const katex =3D require('katex') let input =3D process.argv[2].trim() let disp =3D true if (input.slice(0, 2) =3D=3D=3D '\\[' || input.slice(0, 2) =3D=3D=3D '$$') = { input =3D input.slice(2, -2) } else if (input.slice(0, 2) =3D=3D=3D '\\(') { input =3D input.slice(2, -2) disp =3D false } else if (input.slice(0, 1) =3D=3D=3D '$') { input =3D input.slice(1, -1) disp =3D false } else { console.error("Did you quote the input correctly?") process.exit(1) } console.log(katex.renderToString( input, { displayMode: disp, output: 'mathml', trust: true, strict: false, throwOnError: false, } )) On Wed, Feb 21, 2024 at 15:38 Max Nikulin wrote: > On 19/02/2024 02:36, Martin Edstr=C3=B6m wrote: > > +Since this is a shell-command, remember to use single-quotes > > +around \\=3D'%i\\=3D', not double-quotes! Else a math fragment such > > +as \"$y =3D 200$\" gets butchered into only \" =3D 200\"." > > I am afraid, the code, not the docstring must be fixed. I have not tried > it, but I expect an issue with > > Test \(f' =3D df/dx\) > > So `shell-quote-argument' is necessary and quotes around %i must be > stripped similar to %s in mailcap entries in `org-open-file'. > > Notice that dollar-math $x =3D y$ is not recommended and considered as > obsolete syntax. Use \(x =3D y\) or \[x =3D y\] (the latter for display m= ath). > --0000000000006afcbc0611e58d2a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Ah yes. My custom Node script (which I h= ope it's OK to paste below) strips the beginnings and ends of the input= . I suppose that it could be done already on the Elisp side, which would ta= ke care of interpreting the $-signs as envvars too.
=
const katex =3D require('katex')
let= input =3D process.argv[2].trim()
let disp =3D true
if (input.slice(0= , 2) =3D=3D=3D '\\[' || input.slice(0, 2) =3D=3D=3D '$$') {=
=C2=A0 input =3D input.slice(2, -2)
}
else if (input.slice(0, 2) = =3D=3D=3D '\\(') {
=C2=A0 input =3D input.slice(2, -2)
=C2=A0= disp =3D false
}
else if (input.slice(0, 1) =3D=3D=3D '$') {=
=C2=A0 input =3D input.slice(1, -1)
=C2=A0 disp =3D false
}
el= se {
=C2=A0 console.error("Did you quote the input correctly?"= )
=C2=A0 process.exit(1)
}
console.log(katex.renderToString(
= =C2=A0 input, {
=C2=A0 =C2=A0 displayMode: disp,
=C2=A0 =C2=A0 output= : 'mathml',
=C2=A0 =C2=A0 trust: true,
=C2=A0 =C2=A0 strict: = false,
=C2=A0 =C2=A0 throwOnError: false,
=C2=A0 }
))

On Wed, Feb 21, 2024 at 15:38 Max Nikulin <manikulin@gmail.com> wrote:
<= blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-l= eft:1px solid rgb(204,204,204);padding-left:1ex">On 19/02/2024 02:36, Marti= n Edstr=C3=B6m wrote:
> +Since this is a shell-command, remember to use single-quotes
> +around \\=3D'%i\\=3D', not double-quotes!=C2=A0 Else a math f= ragment such
> +as \"$y =3D 200$\" gets butchered into only \" =3D 200= \"."

I am afraid, the code, not the docstring must be fixed. I have not tried it, but I expect an issue with

=C2=A0 =C2=A0 =C2=A0Test \(f' =3D df/dx\)

So `shell-quote-argument' is necessary and quotes around %i must be stripped similar to %s in mailcap entries in `org-open-file'.

Notice that dollar-math $x =3D y$ is not recommended and considered as
obsolete syntax. Use \(x =3D y\) or \[x =3D y\] (the latter for display mat= h).
--0000000000006afcbc0611e58d2a--