\documentclass{scrreprt}
\usepackage{microtype}

\usepackage{graphicx}
\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}
% Set default figure placement to htbp
\makeatletter
\def\fps@figure{htbp}
\makeatother
% Don't number figures by chapter
\usepackage{chngcntr}
\counterwithout{figure}{chapter}
% Change caption formatting (KOMA-script)
%% See also at the end of polyglossia bloc
\setkomafont{captionlabel}{\sffamily\bfseries}
\renewcommand*{\captionformat}{ : }

\usepackage[normalem]{ulem}
$if(highlighting-macros)$
$highlighting-macros$
$endif$
\usepackage[dvipsnames,svgnames*,x11names*]{xcolor}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\urlstyle{same} % disable monospaced font for URLs
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{$if(secnumdepth)$$secnumdepth$$else$5$endif$}

\usepackage{parskip}
\setlength{\parindent}{1em}

\usepackage{polyglossia}
\setmainlanguage[autospacing=false, autospaceguillemets=false, frenchfootnote=true]{french}
\setmainfont[Script=Latin, Letters=Uppercase, Kerning=On, Diacritics=MarkToBase, Ligatures=Common, Numbers=Proportional]{cochineal}
\setsansfont[Script=Latin, Diacritics=MarkToBase, Ligatures=Common, Numbers=Proportional]{Libertinus Sans}
\setmonofont{Nimbus Mono}
% Prevent polyglossia from setting figure labels to small caps
\gappto\captionsfrench{\def\figurename{Fig.}}


\renewcommand{\labelitemi}{—}
\renewcommand{\labelitemii}{–}

\usepackage{longtable,booktabs,array}

\usepackage{hyperref}
\hypersetup{
$if(title-meta)$
pdftitle={$title-meta$},
$endif$
$if(author-meta)$
pdfauthor={$author-meta$},
$endif$
$if(lang)$
pdflang={$lang$},
$endif$
$if(subject)$
pdfsubject={$subject$},
$endif$
$if(keywords)$
pdfkeywords={$for(keywords)$$keywords$$sep$, $endfor$},
$endif$
colorlinks=true,
linkcolor=$if(linkcolor)$$linkcolor$$else$Maroon$endif$,
filecolor=$if(filecolor)$$filecolor$$else$Maroon$endif$,
citecolor=$if(citecolor)$$citecolor$$else$Blue$endif$,
urlcolor=$if(urlcolor)$$urlcolor$$else$Blue$endif$,
pdfcreator={LaTeX via pandoc}}

\title{$title$}
\makeatletter
\providecommand{\subtitle}[1]{% add subtitle to \maketitle
\apptocmd{\@title}{\par {\large #1 \par}}{}{}
}
\makeatother
\subtitle{$subtitle$}
\author{$for(author)$$author$$sep$ \and $endfor$}
\date{$date$}

\begin{document}
$if(has-frontmatter)$
\frontmatter
$endif$
$if(title)$
\maketitle
$if(abstract)$
\begin{abstract}
$abstract$
\end{abstract}
$endif$
$endif$

$if(toc)$
$if(toc-title)$
\renewcommand*\contentsname{$toc-title$}
$endif$
{
$if(colorlinks)$
\hypersetup{linkcolor=$if(toccolor)$$toccolor$$else$$endif$}
$endif$
\setcounter{tocdepth}{$toc-depth$}
\tableofcontents
}
$endif$
$if(lot)$
\listoftables
$endif$
$if(lof)$
\listoffigures
$endif$
$if(linestretch)$
\setstretch{$linestretch$}
$endif$
$if(has-frontmatter)$
\mainmatter
$endif$
$body$

$if(has-frontmatter)$
\backmatter
$endif$

$for(include-after)$
$include-after$
$endfor$
\end{document}
