How can I alter the answer from this question (which uses a lua-filter), so that it outputs tikz figures in a docx document, but also extracts content from non-pandoc friendly environments (as it does by default in v2.2.3), such as tcolorbox. For example, creating main.tex:
\documentclass{article}
\usepackage{amsmath,tcolorbox,tikz}
\begin{document}
\begin{tcolorbox}[colback=red!5!white,colframe=red!75!black]
Some content and an equation $a=b$
\end{tcolorbox}
\begin{center}
\begin{tikzpicture}
\draw (0,0) -- (4,4);
\end{tikzpicture}
\end{center}
\end{document}
If I run:
pandoc main.tex -t docx -o main.docx
I will get the content of the tcolorbox in the docx but not the tikz figure. Whereas, If I run:
pandoc main.tex --from latex+raw_tex -t docx -o main.docx --lua-filter=tikz-to-png.lua
I will get the tikz figure, but not the content of tcolorbox in the docx.
I'm thinking that maybe this section of the lua-filter code should return something other than nil:
function RawBlock(el)
-- Don't alter element if it's not a tikzpicture environment
if not el.text:match'^\\begin{tikzpicture}' then
return nil
end
Having looked in the Documentation at the lua-filters on Github, I have a feeling I need to use something like pandoc.walk_block, but can't figure it out.
(it would also be nice to but the tcolorbox content in a box, but that's for later)