Thanks! Exactly what i needed to know. 

-Chris

On Sun, Jan 24, 2021, 11:58 AM John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> wrote:

You need a filter, but it would be a simple one.

Something like

function latex(s)
  return pandoc.RawBlock('latex', s)
end

function Div(el)
  if el.classes[1] == 'solution' then
    return { latex('\begin{solution}'), el.content, latex('\end{solution}') }
  end
end

Chris Diaz <chris.diaz26-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> Hello,
>
> I'm looking for advice on how to produce HTML and LaTeX from Markdown using
> fenced divs (or something else) to apply custom styles to specific portions
> of the document.
>
> For example, I'm hoping to write something like this:
>
> ::: solution
> Solution text here.
> :::
>
> in order to produce this when HTML is the output (already works):
>
> <div class="solution">
> Solution text here.
> </div>
>
> and this when LaTeX/PDF is the output:
>
> \begin{solution}
> Solution text here.
> \end{solution}
>
> This idea comes from Bookdown's
> <https://bookdown.org/yihui/bookdown/custom-blocks.html> Custom Blocks
> feature, but I'm wondering if there's a way to do this with Pandoc, or if
> this would require a Lua filter.
>
> Thanks,
> Chris
>
> --
> 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@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/8ba84992-d792-4333-aae0-560147ef79d4n%40googlegroups.com.

--
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/CAMkDs%3DNHev6VHpGEq6qiYGbOMgMr6RqKzu0E9dcsr1kZFXO-Ow%40mail.gmail.com.