Open ProgramFan opened 6 years ago
Thank you for submitting a bug report. However, we cannot improve pandoc or help you unless you give us all of the following information.
From Contributing to pandoc:
Make sure you can reproduce the bug with the latest released version of pandoc (or, even better, the development version).
Your report should give detailed, reproducible instructions, including
- the pandoc version (check using
pandoc -v
)- the exact command line used
- the exact input used
- the output received
- the output you expected instead
A small test case (just a few lines) is ideal. If your input is large, try to whittle it down to a minimum working example.
Please also search the (open and closed) issues to make sure the issue hasn't come up before. Check the User's Guide and FAQs for anything relevant. Finally, ask questions on pandoc-discuss.
@mb21 I think this is meant as an enhancement request rather than a bug report. As I understand it, the idea is to add a --minted
option that works like --listings
, causing LaTeX code blocks to be produced using the minted environment.
@ProgramFan Have you tried the built-in highlighting pandoc provides? Over a hundred languages are supported, and the highlighting scheme can easily be customized. And this works not just in latex output, but in HTML and docx. Just curious why you'd want to use minted instead of that.
Thanks for the quick response, @mb21 @jgm .
I am considering the minted option, not because of the lack of languages in the built-in highlighter, but because of the lack of customizability of the highlighter in latex.
For example, the built-in highlighter does not support line wrapping for latex. And there are not too many ways to customize the frame and the background of a code block in latex. And the listing package lacks support for a variety of languages (for example, cmake).
The following is an example:
if (${pkg}_FOUND)
return()
endif()
if (NOT ${pkg}_ROOT)
set(${pkg}_ROOT xxx)
endif()
find_package(LibFindMacros REQUIRED)
set(${pkg}_DEPS @PKG_DEPENDENCIES@)
libfind_check_dependencies(${pkg} NAMES ${pkg}_DEPS REQUIRED)
libfind_check_includes(${pkg} NAMES libmesh.h PATHS ${pkg}_ROOT/include NO_DEFAULT_PATH)
libfind_check_components(${pkg} NAMES components PATHS ${pkg}_ROOT/include NO_DEFAULT_PATH)
include(${pkg}Version.cmake) # Or directly set the version.
libfind_process(${pkg})
Rendering to pdf with pandoc 2.0.3 as
pandoc -f markdown -o 1.pdf --template eisvogel Test.md
produces:
Yet with pandoc -f markdown -o 1.pdf --template eisvogel --listings Test.md
produces:
Since minted provides macros quite similar to those of the listings packages, I guess it would not cause too much trouble for such an option. This contributes to why I am considering it.
@jgm What is actually the default environment that pandoc uses for syntax highlighting in LaTeX? If I don't use the --listings
options I get:
\begin{Shaded}
\begin{Highlighting}[]
... all the source code interspersed with custom commands
\end{Highlighting}
\end{Shaded}
Is this stuff from the skylighting library mention in the docs?
A minted
option similar to the --listings
option would be useful to me because I sometimes need to convert .md to .tex, and then use those .tex files in a custom latex template that is then compiled (everything is compiled through a makefile). So the default pandoc syntax highlighting is no-go when I need to go to .tex instead of directly to .pdf. And minted
has much more detailed highlighting than listings
.
It shouldn't be too hard though, it's basically just
\begin{minted}[bash]
...
\end{minted}
instead of
\begin{lstlisting}[language=Bash]
...
\end{lstlisting}
I know one could do this through a filter, but IMO it makes sense to support minted
when listings
is supported, especially when it's so straight forward to do :-)
See also https://pypi.org/project/pandoc-minted/ ?
Not really an issue, though. But minted (https://github.com/gpoore/minted) combines pygments with latex, yet supports plenty of customizations. Since the listings package support just a few languages, tt would be nice if the latex writer can output code blocks with the minted environments (with language passed in). Is it possible?