Background
I am looking to convert some LaTeX files I have already written into markdown for use on my Jekyll site hosted by GitHub Pages. The command
$ pandoc --mathjax -f latex -t gfm+tex_math_dollars my_file.tex -o my_file.md
works quite well for the majority of the file, creates div
s around environments like proof
or theorem
, and handles listings
for code.
The issues is that pandoc
will strip all of the LaTeX code from an environment that it does not recognize, such as the algorithm
environment, except for basic $x+y$
-type expressions. Other issues I've found here and here about custom templates only seem to apply when converting from markdown to LaTeX.
The pandoc --filter
option only works after the file is parsed. Pandoc parses out surrounding egin
and end
statements of algorithm
, without making a Div
to separate the algorithm
environment, so it is nearly impossible to recreate the algorithm using a filter.
Question
Is there a way to tell pandoc
how to process an unknown LaTeX environment (i.e. algorithm
) and the special subcommands therein?
At the very least I'm looking for the reverse of this pandoc discussion, so that the environment is wrapped in a 'Div' and can be processed with --filter
.
See also: discussion on Jekyll Talk
question from:
https://stackoverflow.com/questions/65930404/pandoc-latex-to-markdown-do-not-parse-environment 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…