From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/32219 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Bastien DUMONT Newsgroups: gmane.text.pandoc Subject: Re: Can math elements have attributes Date: Wed, 22 Feb 2023 16:38:32 +0000 Message-ID: References: <0845b275-aa43-4fc3-86a5-17b20de652een@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19480"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBDCINCES2QJRBCUK3GPQMGQEKYDSD6Y-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Wed Feb 22 17:38:39 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-ed1-f56.google.com ([209.85.208.56]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pUs8c-0004pN-54 for gtp-pandoc-discuss@m.gmane-mx.org; Wed, 22 Feb 2023 17:38:38 +0100 Original-Received: by mail-ed1-f56.google.com with SMTP id er17-20020a056402449100b004ad793116d5sf10023888edb.23 for ; Wed, 22 Feb 2023 08:38:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1677083917; cv=pass; d=google.com; s=arc-20160816; b=JaQ+pZKTPzaiaVijx3oEbG625qJNHGmGKSAtYncYIIK1S/yCDdJ2M92LjV4A1MAirL Uncpqg1XZnyXvgE8I43b6Fw+iGep4pwYZr4mjaISfTJR6h1X+lX2iFEkvril3aCUrfJW gJcyECmFn1yynkiVOoWJaeyeinYP07ESVfkCuJvilGt4fp1WQiMPELks5sMCVe71kAzz Re2TLTrNaxh0UKQRbV1KDOYj9bdTo6kiTNRul5o6M4x+zHhL44eF/TJ40iWJo6+ua8fe hKdTs3jO+U5sbyL/9OFfjNGJT9S943K5DSXUJk+W3lr/bvl9wNww8F+6KVatRrFBxsIZ azvQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:to:from:date:sender:dkim-signature; bh=bmY2JF+s4EvLuDnDSA7QWUg9MKV8Z/qYXk2IJusbp1A=; b=iMKuUr3w21twx1zVrSITHxQ6QAFVxWMeXjqM0TD2RN+nPCDSv/gjHOncUTomURrxsZ fVsdzdd3KsYsEcYPDptlp6cjDDEfzkYQdzxsA+PLm+5SN0cEY2aDTi0PfIHuhFrSpt5a 4Cu4hWCEuspCGl8vFsjCEmDwPRDRcLezCNTV94K1VHWdiDbhAlcW+VgbBGXfIulWUwMj X6dqJTn5KPxw2bdDhPJ2F0YLX13yhxUKRqCBPUGQCXkffke1VmKqwSFedPye+qtDccGg njqOk2xFhMjwGpS3AgTahIzpGNiCWzyo9YHtzfOuD5MZN9vYi77EIwe+NPjG727Jk5dL OiOA== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=BHyJmH4F; spf=pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.65 as permitted sender) smtp.mailfrom=bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:to:from:date:sender:from:to:cc :subject:date:message-id:reply-to; bh=bmY2JF+s4EvLuDnDSA7QWUg9MKV8Z/qYXk2IJusbp1A=; b=awJM2/I0yb/1drbIBUNYhoS9faIZhbsqKSWd4BDfC6a82Pgg9oXA/OI9jghwZ6cp5F DiF455Yq2tbcu+9Ejo/ILhOvLMYwspl1ypdTSIKdMCLm6F4lAIjpGiOt2OLonL8CWrhE aVEuZFUr/vOjLQdUd9tBwDnTkEjLiM9fJKOnQC8krXa7LkTgs8WFBHCWgvhLxYZmROVT gnq7kMoVVpsDS7Ow2Ugz41KvJHudMSBA7c8iT0ay+DOlHanbzywFo3GCrLwqku46Pmjw hAOypbCrLNpyVwaBhz3CJFwDwBZsjJRj3Rn+RCC/XKmUp X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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-authentication-results:x-original-sender:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:to:from:date:x-gm-message-state :sender:from:to:cc:subject:date:message-id:reply-to; bh=bmY2JF+s4EvLuDnDSA7QWUg9MKV8Z/qYXk2IJusbp1A=; b=VQKlfnYosvhY7F8NFfs0IMzGB5fsPFw9PVGpo13VGArQ2mt+PwB5x3ItgEjwtvniZb PuVW7fC3n6ZZxWkURddf1WPkbhGsl0WYwRhtoOseK605ihwEi8l4/6ZTSpUHkCRC3rW/ GGteHDJSre2W+U9hPq3i0kBjc9bF97YKiEP/BBmY+pkxqyQG9jj36YPNyl+8NOM7/PNx xX6BC5F7i7A5cCmKcy7NtN56t6koxhYmDZz4srqSxC//J/8YNxrJWoArR9VQDhCMqA9a Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AO0yUKWdj1NUFoeEE+E2PLKAZvYtk0R+SLxosRfv585nkN4QLdmBff7l CVCMTrxWevNM1FyrXIJXh9g= X-Google-Smtp-Source: AK7set9fHB2kW+CUaiR9RkF+l4Ejlw+PjhgZr2GQtGY0g2ydkFhrqTBE9RdAOc4XopykiZrcS5h3pA== X-Received: by 2002:a17:906:b201:b0:8e7:916f:d53 with SMTP id p1-20020a170906b20100b008e7916f0d53mr1177561ejz.11.1677083917660; Wed, 22 Feb 2023 08:38:37 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6402:4305:b0:4ad:73cb:b525 with SMTP id m5-20020a056402430500b004ad73cbb525ls8156889edc.3.-pod-prod-gmail; Wed, 22 Feb 2023 08:38:33 -0800 (PST) X-Received: by 2002:a05:6402:14cf:b0:4aa:a442:4213 with SMTP id f15-20020a05640214cf00b004aaa4424213mr7518633edx.35.1677083913753; Wed, 22 Feb 2023 08:38:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677083913; cv=none; d=google.com; s=arc-20160816; b=sFtytnEiRjOHUxuah8Q4QLLnuWmoWUBUxmE40sKNJqA3wJ/bhmDOzU6zboN7zv4DzC Hwc7vjQ2Y2+baXklOiAmXl4waiPFwHwAPKfqBqVDdlNNzxzXLiZn3xM+TxB52ExsKnCa +5m2MYidWQ9ey+TtYRLczrqe0avMeeveiaguwnRgOqpw7YRo+JwselC2VL+oKkUJt7g1 7k2B7xKH8jBbgWfiwAF0RhCF6Y7NSwVvYFRTQbDoGg6/qPeE9uJ/CY5vnuyX0mA+rlqH laVfubyiP88BgMAyO+/c9b2Ixx6pJWsSJ9RXo42/UPKY11P1TT3n5FW9VVM+t+poqbe+ m2Eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:to:from:date :dkim-signature; bh=Yg3x4X/MYedjFIQoSRXhPheXUtPvvYvz7Xs+4Z8JoL0=; b=azVClnVtQe/7+cSlZD0H2Y/mj/48WiWQqA8OR8tULxKZjIvseqSb2t3RbijHUUQSc1 Eq4bckeIbb8paw8IPpPj5FAzFsd3Dw3jHz6r3qLrb6CMD4N3BO2w5Bty1l28RKQ68/8T VAbbMrfCyTxLo+pCsM3nqBs3rHgnkeOYu+XtF9F1mp6+2wNnzWfY2Il4iB92JUcjd1xd id9hOcGMG7cUE1D1UE2kbCY9n3b7otvE8s9uU4Y/neVHteUZSI3lfLPELh8hKMcTeu71 CySEiSK1nTWKVS1sIvSPSLjX7+FVTXbE/qakV5s5ygskeuRJQISai70cYCvvV3MFOdBq WnWA== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=BHyJmH4F; spf=pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.65 as permitted sender) smtp.mailfrom=bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net Original-Received: from mout01.posteo.de (mout01.posteo.de. [185.67.36.65]) by gmr-mx.google.com with ESMTPS id v16-20020a056402175000b004acd48ed527si301773edx.5.2023.02.22.08.38.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Feb 2023 08:38:33 -0800 (PST) Received-SPF: pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.65 as permitted sender) client-ip=185.67.36.65; Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 3FA4A240452 for ; Wed, 22 Feb 2023 17:38:33 +0100 (CET) Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4PMMKh5T91z9rxP for ; Wed, 22 Feb 2023 17:38:32 +0100 (CET) Content-Disposition: inline In-Reply-To: <0845b275-aa43-4fc3-86a5-17b20de652een-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Original-Sender: bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=BHyJmH4F; spf=pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.65 as permitted sender) smtp.mailfrom=bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net 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:32219 Archived-At: For spans, it would rather be: [$$x =3D 1+2$$]{ .cs #math:equation caption=3Dtest} [$x =3D 1+2$]{ .cs #math:equation caption=3Dtest} (Backticks are for code elements.) Le Wednesday 22 February 2023 =C3=A0 08:33:36AM, Julien Dutant a =C3=A9crit= : > I'd check out if there's an extension flag (https://pandoc.org/MANUAL.htm= l# > extensions) you can add to commonmark_x input for it to process multiline > attributes. Or one that can be added to markdown to process math attribut= es. >=20 > As the Pandoc AST doesn't have attributes on Math elements (https://pando= c.org/ > lua-filters.html#type-math) the common mark reader turns them into attrib= utes > of a container Span element, as your output shows. So an alternative woul= d be > to simply write the span in Pandoc's markdown by simply adding a backtick > before and after: >=20 > `$$x =3D 1+2$$`{ .cs #math:equation caption=3Dtest} >=20 > `$x =3D 1+2$ `{ .cs #math:equation caption=3Dtest} >=20 > ~~~{ > =C2=A0 .cs > =C2=A0 #lst:my-listing > =C2=A0 caption=3Dtest=C2=A0} > def f(x): > =C2=A0=C2=A0 return x > ~~~ >=20 > Writing a Lua filter that picks up either is also an option. Picking up > attributes list after equations is probably a bit complicated. But using > pattern matching to process the initial {...} in a code block is more fea= sible. >=20 > All the best, >=20 > On Wednesday, February 22, 2023 at 8:15:53 AM UTC A A wrote: >=20 > Anyone? I also opened an issue in Github but no response. >=20 > On Fri, 17 Feb 2023 at 12:01, A A wrote: >=20 > Dear all, >=20 >=20 > Having not received a response to my query below, I ran a few of = my own > tests to try to understand what is going on. >=20 > It seems that commonmark_x does recognize attributes for both inl= ine > and display math. If I have the following in my markdown file: >=20 > $$x =3D 1+2$${ .cs #math:equation caption=3Dtest} >=20 > $x =3D 1+2${ .cs #math:equation caption=3Dtest} >=20 > ~~~{ > .cs > #lst:my-listing > caption=3Dtest > } > def f(x): > return x > ~~~ >=20 > And I run pandoc --from commonmark_x --to native test.md I will g= et the > following: >=20 > [ Para > [ Span > ( "math:equation" , [ "cs" ] , [ ( "caption" , "test" ) ]= ) > [ Math DisplayMath "x =3D 1+2" ] > ] > , Para > [ Span > ( "math:equation" , [ "cs" ] , [ ( "caption" , "test" ) ]= ) > [ Math InlineMath "x =3D 1+2" ] > ] > , CodeBlock > ( "" , [ "{" ] , [] ) > " .cs \n #lst:my-listing \n caption=3Dtest\n }\ndef f(x):= \n return x" > ] >=20 > Notice that the multiline attributes for the CodeBlock element ar= e not > picked up. If I instead try pandoc --from markdown --to native te= st.md: >=20 > [ Para > [ Math DisplayMath "x =3D 1+2" > , Str "{" > , Space > , Str ".cs" > , Space > , Str "#math:equation" > , Space > , Str "caption=3Dtest}" > ] > , Para > [ Math InlineMath "x =3D 1+2" > , Str "{" > , Space > , Str ".cs" > , Space > , Str "#math:equation" > , Space > , Str "caption=3Dtest}" > ] > , CodeBlock > ( "lst:my-listing" , [ "cs" ] , [ ( "caption" , "test" ) ] ) > "def f(x):\n return x" > ] >=20 >=20 > The attributes in the CodeBlock element are picked up, but the > attributes for display and inline math are not. >=20 > Unfortunately, for my use case I would like to be able to assign > multiline attributes to code block elements and assign attributes= to > display and inline math elements. >=20 > Is there a way to achieve both in the same markdown file? Thanks = for > your consideration. >=20 > Regards, >=20 > Amine >=20 >=20 > ---------- Forwarded message --------- > From: A A > Date: Wed, 8 Feb 2023 at 13:52 > Subject: Can math elements have attributes > To: >=20 >=20 > Dear all, >=20 > I am writing my own pandoc to latex converter using panflute and = would > like to attach attributes to Math elements. I have tried the foll= owing > syntax, but it seems that the attribute is not being picked up by > panflute: >=20 > ``` > $$x=3Dy$${ a=3Db } > ``` >=20 > I did some of my own research to figure out what I was doing wron= g. And > a couple of things became apparent: >=20 > - On the one hand, it looks like pandoc might not support this: > =C2=A0 =C2=A0 - [1]https://github.com/jgm/pandoc/issues/684 > =C2=A0 =C2=A0 - [2]https://github.com/jgm/pandoc/issues/5286 > - On the other hand, `pandoc-crossref` seems to be able to handle= this > syntax: > =C2=A0 =C2=A0 - [3]https://github.com/lierdakil/pandoc-crossref > =C2=A0 =C2=A0 - [4]https://lierdakil.github.io/pandoc-crossref/#e= quation-labels >=20 > Is this currently supported by pandoc? If not then how is > `pandoc-crossref` able to handle it? Thanks for your consideratio= n. >=20 > Regards, >=20 > Amine >=20 >=20 >=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= email > to [5]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit [6]https://groups.google.com/d/m= sgid/ > pandoc-discuss/0845b275-aa43-4fc3-86a5-17b20de652een%40googlegroups.com. >=20 > References: >=20 > [1] https://github.com/jgm/pandoc/issues/684 > [2] https://github.com/jgm/pandoc/issues/5286 > [3] https://github.com/lierdakil/pandoc-crossref > [4] https://lierdakil.github.io/pandoc-crossref/#equation-labels > [5] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > [6] https://groups.google.com/d/msgid/pandoc-discuss/0845b275-aa43-4fc3-8= 6a5-17b20de652een%40googlegroups.com?utm_medium=3Demail&utm_source=3Dfooter --=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/Y/ZFCMVKXpyaki12%40localhost.