I've been writing a custom LaTeX reader Lua filter to convert a bunch of LaTeX source into Pandoc Markdown, which will be my new source for several documents.
I run the usual filter like the following.
pandoc file.tex \
-f latex+raw_tex \
-t markdown \
-o file.md \
--lua-filter myfilter.lua
This works great. I've been able to convert several custom LaTeX environments into Div
s and the like.
However, when I have standard LaTeX nested inside the custom environment, the filter output leaves that as-is, unconverted. For example.
\begin{custom_environment}
\begin{itemize}
\item foo
\item bar
\end{itemize}
\end{custom_environment}
The custom environment is handled just fine by my filter, but the internal itemize
or tabular
or similar are, left unprocessed, as you would expect.
Is there some way to process the contents of the custom environment using the standard latex
extension (i.e. filter)? I assume it would be a call from the Lua filter.
An idea I have for doing this that I'm trying to avoid is writing the contents to a temporary file and running another pandoc
on that. It seems like such a ubiquitous situation that I'm hoping there's a better way. Thanks!