% ┌                                                ┐
% │                     Minted                     │
% └                                                ┘
\usepackage{minted}
\usepackage{fancyvrb}

% Args: Code.
% Alternative: Use \mint{<language>}|code|
\newcommand{\inlinecode}[1]{\shade{gray}{\texttt{#1}}}

% Args: Language, Code
\newenvironment{code}[1]{
	\VerbatimEnvironment
	\begin{minted}[
    autogobble,
    breaklines,
    breakindentnchars=2,
    frame=lines,
    framesep=2mm,
    mathescape,
    baselinestretch=1.1,
    linenos
    ]{#1}}
{\end{minted}}

% Args: Language, file relative to root file
\newcommand{\inputcode}[2]{
	\inputminted[
		autogobble,
		breaklines,
		breakindentnchars=2,
		frame=lines,
		framesep=2mm,
		mathescape,
		baselinestretch=1.1,
		linenos
	]{#1}{#2}
}

% Args: Language, Base directory (with trailing slash), file (no slash at start)
\newcommand{\inputcodewithfilename}[3]{
	\begin{figure}[h!]
		\texttt{File: \detokenize{#3}}
		\rmvspace
		\inputcode{#1}{#2#3}
	\end{figure}
}
