image frame borders in pdf from latex template with pandoc, markdown

I'm using a tex template similar to https://github.com/davecap/markdown-latex-boilerplate/blob/master/template.tex

How can I get a frame around images which are passed from standard markdown code to the tex template?

Obviously this code handles the image sizes, but how can I add the graphics frames?

$if(graphics)$
\usepackage{graphicx,grffile}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
$endif$


...

\begin{document}
$body$
\end{document}