From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/30658 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Bastien DUMONT Newsgroups: gmane.text.pandoc Subject: Re: AW: How to make my latex environment accessible from markdown via short-code? Date: Thu, 2 Jun 2022 08:44:08 +0000 Message-ID: References: <4de0a599-a196-438a-928c-b0895b35afb6n@googlegroups.com> <2acb8d6c2b3f4042a0e940cbda7899e4@unibe.ch> 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="6298"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBDCINCES2QJRBW7Q4GKAMGQEDQQGAJA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Thu Jun 02 10:44:15 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-lf1-f56.google.com ([209.85.167.56]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nwgRD-0001Rh-FA for gtp-pandoc-discuss@m.gmane-mx.org; Thu, 02 Jun 2022 10:44:15 +0200 Original-Received: by mail-lf1-f56.google.com with SMTP id n3-20020ac242c3000000b00473d8af3a0csf2225675lfl.21 for ; Thu, 02 Jun 2022 01:44:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1654159455; cv=pass; d=google.com; s=arc-20160816; b=gUiEW9jw/Qfn6PY4JTMBAH2VdIjRGE46dpFzFLZk4VMtDfT9605VmotX8c5dTmUfp8 wqPxrCuBV/Id0VC/dbM5dzxNDXKqYgmv/KE3BsAEW7UlulxRrRkeDwfpOdZjKeuHpwFA 9Gp2cARJ1iXMWDHn3cn4BcpW22DuoOtH2D+PVAiMaQUQYbFIJ7JuLw2Q2Hd9d+2UItZj Pk8w8YNRWI/9jPKIQZPA7Z037GxYQuuXEV+6ucle8uO3SU6S2UR1bt7OlgNBsQoMk1hI cwQzNjSD4gPCzR2E/AR2L6ArxLQKzdkRwd6xg2D3oAuP4g38zyPGE53mAR7++BG/JsUM /LHw== 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=eBIU62t/4Om1m3s1tz0f2MYlPbRc5gPki2+XiAXcNbA=; b=LdYYt1AgGqhC0zd+T6lgqagzUS+vRwFCKGzTXjyeuN3MKgQdGS63SL0r5JuBd1Cpf4 JEUTnCie5q8CFN35lwa56zzBBKXllc9lep6GJa1UucThvGcAabqzL+XdCfnubc9Wjp7l yR33oXMN4QYLFT0X3NuGH3Px794LIHnpeDPDCMMuSHUoFRopmqYEgcO5Pska4M2iTV8E 9+i/nusV0TVg77PjV6BiQc6i6vf9f05GA8qpF3+GtQzmJ19c3C1hJI4vb3pWJIIFUjDt hSI1DzS5G79h0q/Nb/EDVASNsGbSBT/mHED7O/MKkKciSgRV4jW4V6UvHDH5ikoaKg0q h18A== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=fC+k39H9; 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=sender:date:from:to:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :x-original-sender:x-original-authentication-results:reply-to :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=eBIU62t/4Om1m3s1tz0f2MYlPbRc5gPki2+XiAXcNbA=; b=b/ECOjprL6YSzVDT0SwToTVKxOHlTrSUtf77PJRVlToa3suIrfzqMc2x5NyJ452ePE 4BVglZ1KhIB130Xg2bGIRWIIGvbh1CrSCH/zoZL3X/6QVb86pm/YyHfVcHg+ZYaf0ecd hFU7vIyMAQpiXdmOcR1H60AKUPExubyKuM9TOsAgZUIByEYD9h+Zj7kCWnMOyj0iOqua m+DWYwPO/KGMr1/cz3ffrRjeIt+js+llI9oty+F27BDueqtpz4ymfG8KTTn6urS6L9BD KNF3OcTFOxuBrGzdPUlI27onO3VR1jR8cf7Tk8VJ4/FThaL9RBTTkvXk5Q4M/lLoI3Ql zz5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:date:from:to:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=eBIU62t/4Om1m3s1tz0f2MYlPbRc5gPki2+XiAXcNbA=; b=wP4uJHDfMhQ+YIQELS88cKdVi3cQPP+p/K2nhdboAtj+N/SgceeVn0L83GB7Z59fz+ W+Zh6/KDwtw733U6Q6kpTnTmb5TPgZ+bbf+ScPFJuWZ7UDawqa9tDbsR86fZPmXJVs+c Cs8VxpAKz2WJPPWkKtj2IKm09Ui5H4DiLmUIr7R+07KJlaNW53bmStjrr/tb1hdapSSG /c9DaqHyqHsCRNkxZQi5xuQOMYCELFfcRCBSUq93ncAEZVNbv9Gtj5QMDqXw/c/9R8JB vJcmijNy50MxFXWKFj/NUOAnlhjLNhrGPocK0bXQ7p85 Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM531f/eotsXEx0cJA6d5kyr+F++SaIK3ebVbNKg26FzyIRSLTgpMb DjMlXpOqlKBuGYeufm18YMM= X-Google-Smtp-Source: ABdhPJxuHrZiPxHmkwBBFhMNJf1ZCC01ZIcGEZHJ9IT+8YU+VVp2yML9y3E00JYtgtFAlMQ9D6QDWg== X-Received: by 2002:a05:6512:400a:b0:479:9ed:a71b with SMTP id br10-20020a056512400a00b0047909eda71bmr2859375lfb.488.1654159454792; Thu, 02 Jun 2022 01:44:14 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:651c:1789:b0:255:4eec:4231 with SMTP id bn9-20020a05651c178900b002554eec4231ls939906ljb.7.gmail; Thu, 02 Jun 2022 01:44:10 -0700 (PDT) X-Received: by 2002:a2e:a546:0:b0:254:b2:cc6 with SMTP id e6-20020a2ea546000000b0025400b20cc6mr25479921ljn.504.1654159450462; Thu, 02 Jun 2022 01:44:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654159450; cv=none; d=google.com; s=arc-20160816; b=VDbh+ejGOcH+Q1QZamlIQa6a1jec5ztqLH2EnaMMFEIJBnYaR6BpiYMrEuBD//geCl P9IGIT+LOpjfdXzAoJY0QOaz0JltHGBwnBZDrX43nwXDz5Va0aRc0CR297sEDQ17bnWI uxGt3kpcaldS1Zi1nK3ROWTCSZJbVV7KpLeKs+VsRULTNGA2IeALWtA3Ewy/St/P6rAb nQwP7LtUkdkqSdySlegIDtKlWe1cI9TlgGgEIE1CH0LUU52m/I0NyMo74AH5eWQ5tNrZ MZyFzEgu0nY2HS/GMlD2hpSmYKPs8QdqfBXo1boJg+vGFhahWclYjY+RojHtkDAoPuSo 7jpQ== 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=CFfNrIayRUf8bo/9jCxHS3QBBIUfDyF03mIpgKb/f8U=; b=m4D38IEsPNEaFQSKZ67xoADvORtDpKhmB1sXA+01MO5KHiNu6+G9Gn+Li3N2/0P8QC 5SFJ8cS+UYXxvNgMKm7pMfip3quuI5EHf1jJkBVOYKpesUX0O+d/Tf9pX+A1PqzDaOec 36YPSK/iT1XouKrQQX/EZHPTK6Hi9df5anM3sbIt8nDBFTX0UFStuVBKszJkNd68lPMt Z8aIzALF++Snw11ci4mxi8nAJaRBQ0VPSv2uCir8Q0EPPIWCDnfx3/uLaxwSt2WaNYWH /vl9Y8XyWglogRe60nPSqwzgVEJ6E9MsivDaT1RxjaTZX9AZ5P94a81TyxCGCZjmmFCA uhEw== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=fC+k39H9; 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 o18-20020ac24c52000000b00478f1faa988si199754lfk.13.2022.06.02.01.44.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jun 2022 01:44:10 -0700 (PDT) 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 5E07A240027 for ; Thu, 2 Jun 2022 10:44:09 +0200 (CEST) Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4LDKLc6rG5z6tmQ for ; Thu, 2 Jun 2022 10:44:08 +0200 (CEST) Content-Disposition: inline In-Reply-To: <2acb8d6c2b3f4042a0e940cbda7899e4-NSENcxR/0n0@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=fC+k39H9; 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:30658 Archived-At: Oh yes, you're right, sorry! Le Thursday 02 June 2022 =C3=A0 08:35:22AM, denis.maier-NSENcxR/0n0@public.gmane.org a =C3=A9cr= it : > Or, maybe even a RawBlock? Like in that function: > local function latex(s) > return pandoc.RawBlock('latex', s) > end >=20 >=20 > > -----Urspr=C3=BCngliche Nachricht----- > > Von: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> Im Auftrag von Bastien DUMONT > > Gesendet: Donnerstag, 2. Juni 2022 10:34 > > An: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > Betreff: Re: How to make my latex environment accessible from markdown > > via short-code? > >=20 > > To complement Denis' answer, your Markdown chunks in "hint.lua" are > > handled like strings because you created them as Str objects. What you = want > > is to return a CodeBlock (https://pandoc.org/lua- > > filters.html#pandoc.codeblock), e.g.=C2=A0`pandoc.CodeBlock("latex", > > "\\begin{guidehint}")`. > >=20 > > More generally, Pandoc has already parsed the input file when it applie= s > > filters. Filters manipulate objects in the internal representation of t= he > > document and should return such objects. In exceptional cases where you > > really need to parse a Markdown string inside a filter, use pandoc.read= . > >=20 > > Le Thursday 02 June 2022 =C3=A0 01:17:44AM, Stefan Schroeder a =C3=A9cr= it : > > > I am converting markdown to pdf via latex using my own template. > > > In the template I have defined a new environment called 'hint' that i= s > > > like a call-out. > > > > > > This works: > > > --- > > > ```{=3Dlatex} > > > \begin{hint} > > > ``` > > > Lorem ipsum dolor sit amet, > > > ```{=3Dlatex} > > > \end{hint} > > > ``` > > > --- > > > The Lorem text appears in the callout-environment. > > > > > > I want to make the environment accessible more conveniently via a sho= rt- > > code. > > > > > > I have created a new lua-filter, 'hint.lua' that I successfully inclu= de: > > > return { > > > { > > > Str =3D function (elem) > > > if elem.text =3D=3D "{{hint_end}}" then > > > return pandoc.Str("```{=3Dlatex}\n\\end{guidehint}\n```\n") > > > elseif elem.text =3D=3D "{{hint_begin}}" then > > > return pandoc.Str "```{=3Dlatex}\\begin{guidehint}```" > > > else > > > return elem > > > end > > > end, > > > } > > > } > > > > > > But when I use it, the macro-text will be included literally: > > > > > > {{hint_begin}} > > > Neque porro quisquam est, > > > {{hint_end}} > > > > > > The code is not interpreted to end up being proper Latex, but it's > > > escaped somehow to become a string literal. > > > Thus my output looks like this: > > > > > > =E2=80=9C=E2=80=98{=3Dlatex}\begin{hint}=E2=80=9C=E2=80=98 Neque porr= o quisquam est, qui dolorem ipsum, > > > quia dolor sit, amet, consectetur, adipisci velit =E2=80=9C=E2=80=98{= =3Dlatex} > > > \end{hint} =E2=80=9C=E2=80=98 > > > > > > How do I make the short-code to get access to my own environments? > > > > > > PS. If there are different apporaches, that'll be nice as well. > > > > > > Thanks > > > Stefan > > > > > > > > > -- > > > 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, sen= d > > > an email to [1]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > To view this discussion on the web visit > > > [2]https://groups.google.com/d/msgid/ > > > pandoc-discuss/4de0a599-a196-438a-928c- > > b0895b35afb6n%40googlegroups.com. > > > > > > References: > > > > > > [1] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > > [2] > > > https://groups.google.com/d/msgid/pandoc-discuss/4de0a599-a196- > > 438a-92 > > > 8c- > > b0895b35afb6n%40googlegroups.com?utm_medium=3Demail&utm_source=3Dfo > > oter > >=20 > > -- > > You received this message because you are subscribed to the Google Grou= ps > > "pandoc-discuss" group. > > To unsubscribe from this group and stop receiving emails from it, send = an > > email 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/Yph14Uv3BuicNJi9%40localhost. >=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 pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit https://groups.google.com/d/msgi= d/pandoc-discuss/2acb8d6c2b3f4042a0e940cbda7899e4%40unibe.ch. --=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/Yph4WGXl6CRlFjkC%40localhost.