I had the same issue, and it turns out that some style was missing for --listings option. I copied parts of the logic from eisvogel.latex template and added some custom styling over it.
\usepackage{listings}
\newcommand{\passthrough}[1]{#1} % required from pandoc to provide inline
\usepackage{xcolor} % custom colors
\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}
\lstdefinestyle{mystyle}{
backgroundcolor=\color{backcolour},
commentstyle=\color{codegreen},
keywordstyle=\color{magenta},
numberstyle=\tiny\color{codegray},
stringstyle=\color{codepurple},
basicstyle=\ttfamily\footnotesize,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
keepspaces=true,
%numbers=left, % I recommend disabling this, as one can use .numberLines in markdown
numbersep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2
}
\lstset{style=mystyle}
% if you want to use cleveref
\usepackage[nameinlink]{cleveref} % must come after hyperref package
\crefname{listing}{code}{codes}
\Crefname{listing}{Code}{Codes}
and the following works fine:
~~~{label=lst:captionAttr .html .numberLines caption="test caption"}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Store</title>
</head>
<body>
<div id="app"></div>
</body>
</html>
~~~
Referencing [@Lst:captionAttr] using cleveref.
Feel free to test in the Pandoc template for Legrand Orange Book: https://github.com/igormcoelho/pandoc-template-legrand-orange-book
pandoc --listings -s -F pandoc-crossref --citeproc --template=orangelegrand.latex book.md -o book.pdf
listingspackage included in the*.texfile? – naphaneal Jan 27 '19 at 17:58pandoc -H ./template.tex ./DOC.md -o ./doc.pdf --listingsandtemplate.texcontains only\usepackage{listings}. – Everettss Jan 27 '19 at 18:14kpsewhich listings.styfrom the shell. if no error is thrown, it's installed properly and the error lies somewhere else. – naphaneal Jan 27 '19 at 19:57kpsewhich listings.styproduce/usr/local/texlive/2018basic/texmf-dist/tex/latex/listings/listings.sty– Everettss Jan 27 '19 at 20:04listingsoutput you have posted isn't missing syntax highlighting. The highlighting is just different, i.e. it is monochrome, roman font and uses bold font for keywords. You can customize the output of listings to fit your needs, here is a good starting point: https://tex.stackexchange.com/a/99638/29873 – DG' Jan 27 '19 at 20:46