Thank you for your suggestion as well, Bastien. I'll keep a note of what you said for reference.

On Thursday, June 2, 2022 at 10:44:14 AM UTC+2 Bastien Dumont wrote:
Oh yes, you're right, sorry!

Le Thursday 02 June 2022 à 08:35:22AM, denis...-NSENcxR/0n0@public.gmane.org a écrit :
> Or, maybe even a RawBlock? Like in that function:
> local function latex(s)
> return pandoc.RawBlock('latex', s)
> end
>
>
> > -----Ursprüngliche Nachricht-----
> > Von: pandoc-...@googlegroups.com <pandoc-
> > dis...@googlegroups.com> Im Auftrag von Bastien DUMONT
> > Gesendet: Donnerstag, 2. Juni 2022 10:34
> > An: pandoc-...@googlegroups.com
> > Betreff: Re: How to make my latex environment accessible from markdown
> > via short-code?
> >
> > 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. `pandoc.CodeBlock("latex",
> > "\\begin{guidehint}")`.
> >
> > 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.
> >
> > Le Thursday 02 June 2022 à 01:17:44AM, Stefan Schroeder a écrit :
> > > 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:
> > > ---
> > > ```{=latex}
> > > \begin{hint}
> > > ```
> > > Lorem ipsum dolor sit amet,
> > > ```{=latex}
> > > \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 = function (elem)
> > > if elem.text == "{{hint_end}}" then
> > > return pandoc.Str("```{=latex}\n\\end{guidehint}\n```\n")
> > > elseif elem.text == "{{hint_begin}}" then
> > > return pandoc.Str "```{=latex}\\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:
> > >
> > > “‘{=latex}\begin{hint}“‘ Neque porro quisquam est, qui dolorem ipsum,
> > > quia dolor sit, amet, consectetur, adipisci velit “‘{=latex}
> > > \end{hint} “‘
> > >
> > > 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-discus...-/JYPxA39Uh5TLH3MbocFFw@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-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> > > [2]
> > > https://groups.google.com/d/msgid/pandoc-discuss/4de0a599-a196-
> > 438a-92
> > > 8c-
> > b0895b35afb6n%40googlegroups.com?utm_medium=email&utm_source=fo
> > oter
> >
> > --
> > 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-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msgid/pandoc-
> > discuss/Yph14Uv3BuicNJi9%40localhost.
>
> --
> 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-discus...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/2acb8d6c2b3f4042a0e940cbda7899e4%40unibe.ch.

--
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/00769f1a-ee10-4fc2-bb22-9cb1ac351450n%40googlegroups.com.