public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: Stefan Schroeder <ondekoza-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: How to make my latex environment accessible from markdown via short-code?
Date: Thu, 2 Jun 2022 01:17:44 -0700 (PDT)	[thread overview]
Message-ID: <4de0a599-a196-438a-928c-b0895b35afb6n@googlegroups.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1823 bytes --]

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 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/4de0a599-a196-438a-928c-b0895b35afb6n%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 2617 bytes --]

             reply	other threads:[~2022-06-02  8:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AQHYdlk/OWfYV7I3oUynfv4PgxHqAa07x2og>
2022-06-02  8:17 ` Stefan Schroeder [this message]
     [not found]   ` <4de0a599-a196-438a-928c-b0895b35afb6n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-06-02  8:28     ` AW: " denis.maier-NSENcxR/0n0
     [not found]       ` <cc1c350768424985bb0f5c9380386904-NSENcxR/0n0@public.gmane.org>
2022-06-02  8:32         ` Stefan Schroeder
2022-06-02  8:33     ` Bastien DUMONT
2022-06-02  8:35       ` AW: " denis.maier-NSENcxR/0n0
     [not found]         ` <2acb8d6c2b3f4042a0e940cbda7899e4-NSENcxR/0n0@public.gmane.org>
2022-06-02  8:44           ` Bastien DUMONT
2022-06-02  8:47             ` Stefan Schroeder
2022-06-02  8:46       ` Stefan Schroeder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4de0a599-a196-438a-928c-b0895b35afb6n@googlegroups.com \
    --to=ondekoza-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).