From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/30657 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Newsgroups: gmane.text.pandoc Subject: AW: How to make my latex environment accessible from markdown via short-code? Date: Thu, 2 Jun 2022 08:35:22 +0000 Message-ID: <2acb8d6c2b3f4042a0e940cbda7899e4@unibe.ch> References: <4de0a599-a196-438a-928c-b0895b35afb6n@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="6071"; mail-complaints-to="usenet@ciao.gmane.io" To: Original-X-From: pandoc-discuss+bncBCZ27W53TUFBBTPM4GKAMGQEI4SLQIA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Thu Jun 02 10:35:30 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-lf1-f60.google.com ([209.85.167.60]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nwgIj-0001PK-ND for gtp-pandoc-discuss@m.gmane-mx.org; Thu, 02 Jun 2022 10:35:29 +0200 Original-Received: by mail-lf1-f60.google.com with SMTP id a29-20020a194f5d000000b004790a4ba4bdsf1206106lfk.11 for ; Thu, 02 Jun 2022 01:35:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1654158929; cv=pass; d=google.com; s=arc-20160816; b=K9PnsETLjgP55GSfZ7+ooTRMqPejr9sNx7DVFS4KAtQ+L5mvKjQdeq38ZkmvV6QGHu 9Q8jXd1y//+72Uow4XVd/TBE4nLUaKqp8ZTDN8MxbuqD0pAUsun7Mefzba8QPrAoW14F euBmb01XQXwkSzQPeJz2NGqHNC6Ke37c/NIEpKw4SDwz0Ixq78/pqvk3U+YInhwD43CH IikWCsfj6uh48v7wEIDZ4bQ+fI1Bfol+iJlWUz0UiuSawW6PZ8BHa631QMkc1mfOi52+ zvwP+KJRHamEXOvoI/YmhFTk+8qh0LPjYncbwQZo62S2YYciHrOKX6/6UxNF60Tv8Z8B H5dQ== 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:mime-version :content-transfer-encoding:content-language:accept-language :in-reply-to:references:message-id:date:thread-index:thread-topic :subject:to:from:sender:dkim-signature; bh=+RmkeAdl8oIIXhy0h+2UsaZXiFNjczXxpGgFx9QDKKI=; b=0QiGZKatls4IAxb2/UexMiOB+bWVM+S+IIBfVZHTwYzHZjmk1z++ZtLlEPL0GjbYM2 NgbiNclRCn8xcCWFOazx9+ctmSqpJM6PxBgiNWhVUibTTtYXvsDo8krZDkazrLmHiGtS ctwn6fvHdh8kvjKwAW8JopA9E08bDz4NmRivjLriVKbbLf33/pX7W2jM1ZtI3J74ZlBV h1VtNF9PHTFgQ/WpVWoTOih1DovS5bGyrEKdI7yfgt392xHP+SDn8huSFtYOe1lW7ElG pnAijOsT/LdL1zHL3B8R2M6qawyUox5/VdmCCHH9eQPOkmf1D6ov69EfcFkEYiq+LGGF 8OLg== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of denis.maier-NSENcxR/0n0@public.gmane.org designates 130.92.0.84 as permitted sender) smtp.mailfrom=denis.maier-NSENcxR/0n0@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=unibe.ch DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=sender:from:to:subject:thread-topic:thread-index:date:message-id :references:in-reply-to:accept-language:content-language :content-transfer-encoding:mime-version: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=+RmkeAdl8oIIXhy0h+2UsaZXiFNjczXxpGgFx9QDKKI=; b=cWkS6r6rzinFlAmPC48KBJGq3V55qXavSfm8gyhft2245Fv3xqFCxjryCFS+KABwDt DYmx/CyvBDHwcl1b05q95sG5o9bbG+xL9cL9Hu2lIp2UJGUy+Trq+N/HxsXieysSpEa/ bh8bRtdssA6X8r9Q5BXOSBF2j2MagVyhz2Ot5iudAO3yQv6Gvo6/QbSVFvIilLCuGSVv JKBaEpUQPHj1kVppenHRyo02Da+CqvrT0GjpBCVIlRcoEaSoomCP3aE00idI0csPr6Re NODD9KSqXtx9dRmvONw+mKHioWpnLzW/h6sYc1oMTzUff5kw57 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:from:to:subject:thread-topic:thread-index :date:message-id:references:in-reply-to:accept-language :content-language:content-transfer-encoding:mime-version :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=+RmkeAdl8oIIXhy0h+2UsaZXiFNjczXxpGgFx9QDKKI=; b=EC/e3cHSiz2bu9g/vpjmsZVkKhgMTQo7fOxCCnqFIulXody3RXB+nyFz9np8g04tNf p8H02i3AjGfGGfHaSSgKHv1QtBMfz5IqZuUtQ0XSEGOg3JYLL7f9d8G7S24ZxZdYWqka 4RL/MeDytL2nLcop7d5PxOpfu/PGCBcXG3M0dJb8/BokQvgVdD0ngo7A5L7o9tXKV0m9 aKZCGlFDG0xYfVVjvnMG4WPIGb2SGrBn4yPccOmu/qLcdudydL/Yg+Pryw+ozyb5J4EZ rIzuk Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM5316Eq21j7JK9I7IIBNsupbdNH09fDrpEC1Fb/g+HBST67gskRXa txup4zHsU/lXp0xcaYLpCyY= X-Google-Smtp-Source: ABdhPJwbsMCTz+vW9HcGbRy/ULeR/xL6u0+aeCa42ZrFT9i+fmKuMmQZQKmCVDI+E7s0oU4lC19u4w== X-Received: by 2002:ac2:442d:0:b0:478:ed89:927f with SMTP id w13-20020ac2442d000000b00478ed89927fmr11124339lfl.545.1654158929089; Thu, 02 Jun 2022 01:35:29 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6512:1693:b0:448:3742:2320 with SMTP id bu19-20020a056512169300b0044837422320ls319633lfb.1.gmail; Thu, 02 Jun 2022 01:35:24 -0700 (PDT) X-Received: by 2002:ac2:4642:0:b0:479:130c:68f2 with SMTP id s2-20020ac24642000000b00479130c68f2mr478416lfo.221.1654158924851; Thu, 02 Jun 2022 01:35:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654158924; cv=none; d=google.com; s=arc-20160816; b=KowEW/6cPUltXLfHBax01D8GPZbrZu0+nzTBSR5TCwEpOM92TEcVKtb8baABsONSpM 7IDWPRygzyDjDf6JUynABat922uK/gn/TfznDOU4GUXZg7xUheaL+/ULSpY+TcnYF1IE s+5VahOIwrRy1OaemXBQNGGmh3BU7TLqQ7PyzBSECt1pMcA0wxX8tMTeyPdkjZ/tbZhW U/yibLcc66Eb5tjKDRne3/Fuk2Yq2L6uUCRXdKxJr8WXtQoDq2lbyEWzwtuxBZcfuL/o exVyT7aSPRhjzhTZmpcbx+Vx+I4BPCSOLBOSnAGYztlT0LQfe46aQKw594CRCEQ4Z6NU TWIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:content-transfer-encoding:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:to:from; bh=Nkb6lO7zDGfBjgOP26M48LLq3vmgk7VBriWW4WuYJFM=; b=uYm/AXdZP2lesGd5tQFCF70xnGqRoYomfKoZK6VJKhyBrIfphprGF/u/UE2ZYn9Zex zCqx1GIGRbGqn3v81g7LpgqJaAZl0JcEsY/wIq6lRawqAN895l9lfJCwugC0Na55jiL7 THjDGRdK7aYFi79I5/D8lkG2YcMHrxQ7McttYhMvf96z6CyC3juNUqBhp6N3JWIFpWv6 zJWj0+RJjkOMOpC5GbkjWReeI7kj2LjeFZTmhUxQAUwghdR/0BaDlqC0WMK2jmBweypQ Mn6mXab+0Igq014MihxPS8FmWrURfhMTMwZ2xodpW3LrN4S9fxrCAha4Pr6HexfYQlX8 koUA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of denis.maier-NSENcxR/0n0@public.gmane.org designates 130.92.0.84 as permitted sender) smtp.mailfrom=denis.maier-NSENcxR/0n0@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=unibe.ch Original-Received: from mailhub-lb3.unibe.ch (mailhub-lb3.unibe.ch. [130.92.0.84]) by gmr-mx.google.com with ESMTPS id x15-20020a056512078f00b004789faf5d76si245422lfr.12.2022.06.02.01.35.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jun 2022 01:35:24 -0700 (PDT) Received-SPF: pass (google.com: domain of denis.maier-NSENcxR/0n0@public.gmane.org designates 130.92.0.84 as permitted sender) client-ip=130.92.0.84; X-Virus-Scanned: By University of Bern - MGW Original-Received: from mail.campus.unibe.ch (aai-edge-02.campus.unibe.ch [130.92.13.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mailhub-lb3.unibe.ch (Postfix) with ESMTPS id 72A4E5000C5 for ; Thu, 2 Jun 2022 10:35:23 +0200 (CEST) Thread-Topic: How to make my latex environment accessible from markdown via short-code? Thread-Index: AQHYdlk/OWfYV7I3oUynfv4PgxHqAa07qK6AgAAhrPA= In-Reply-To: Accept-Language: de-CH, en-US Content-Language: de-DE x-originating-ip: [130.92.13.161] X-Original-Sender: denis.maier-NSENcxR/0n0@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of denis.maier-NSENcxR/0n0@public.gmane.org designates 130.92.0.84 as permitted sender) smtp.mailfrom=denis.maier-NSENcxR/0n0@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=unibe.ch 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:30657 Archived-At: Or, maybe even a RawBlock? Like in that function: local function latex(s) return pandoc.RawBlock('latex', s) end > -----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 wa= nt > 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 applies > filters. Filters manipulate objects in the internal representation of the > 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=A9crit= : > > I am converting markdown to pdf via latex using my own template. > > In the template I have defined a new environment called 'hint' that is > > 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 short= - > code. > > > > I have created a new lua-filter, 'hint.lua' that I successfully include= : > > 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 porro = 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, send > > 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 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/msgid/pandoc- > discuss/Yph14Uv3BuicNJi9%40localhost. --=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/2acb8d6c2b3f4042a0e940cbda7899e4%40unibe.ch.