\documentclass[<<design.font_size>>, <<design.page_size>>]{article}

% Packages:
\usepackage[
    ignoreheadfoot, % set margins without considering header and footer
    top=<<design.margins.page.top>>, % seperation between body and page edge from the top
    bottom=<<design.margins.page.bottom>>, % seperation between body and page edge from the bottom
    left=<<design.margins.page.left>>, % seperation between body and page edge from the left
    right=<<design.margins.page.right>>, % seperation between body and page edge from the right
    footskip=<<design.margins.page.bottom|divide_length_by(2)>>, % seperation between body and footer
    % showframe % for debugging 
]{geometry} % for adjusting page geometry
\usepackage[explicit]{titlesec} % for customizing section titles
\usepackage{tabularx} % for making tables with fixed width columns
\usepackage{array} % tabularx requires this
\usepackage[dvipsnames]{xcolor} % for coloring text
\definecolor{primaryColor}{RGB}{<<design.color.as_rgb_tuple()|join(", ")>>} % define primary color
\usepackage{enumitem} % for customizing lists
\usepackage{fontawesome5} % for using icons
\usepackage{amsmath} % for math
\usepackage[
    pdftitle={<<cv.name>>'s CV},
    pdfauthor={<<cv.name>>},
    colorlinks=true,
    urlcolor=primaryColor
]{hyperref} % for links, metadata and bookmarks
\usepackage[pscoord]{eso-pic} % for floating text on the page
\usepackage{calc} % for calculating lengths
\usepackage{bookmark} % for bookmarks
\usepackage{lastpage} % for getting the total number of pages
\usepackage[default, type1]{sourcesanspro} % for using source sans 3 font
\usepackage{changepage} % for one column entries (adjustwidth environment)
\usepackage{paracol} % for two and three column entries
\usepackage{ifthen} % for conditional statements
\usepackage{needspace} % for avoiding page brake right after the section title

% Ensure that generate pdf is machine readable/ATS parsable:
\ifpdf
    \input{glyphtounicode}
    \pdfgentounicode=1
\fi

% Some settings:
((* if design.text_alignment == "justified-with-no-hyphenation" *))
\usepackage[none]{hyphenat}
\sloppy
((* elif design.text_alignment == "left-aligned" *))
\raggedright
((* endif *))

\pagestyle{empty} % no header or footer
\setcounter{secnumdepth}{0} % no section numbering
\setlength{\parindent}{0pt} % no indentation
\setlength{\topskip}{0pt} % no top skip
((* if design.disable_page_numbering *))
\pagenumbering{gobble} % no page numbering
((* else *))
((* set page_numbering_style_placeholders = {
    "NAME": cv.name,
    "PAGE_NUMBER": "\\thepage{}",
    "TOTAL_PAGES": "\pageref*{LastPage}"
} *))
\setlength{\columnsep}{0.15cm} % set column seperation

\makeatletter
\let\ps@customFooterStyle\ps@plain % Copy the plain style to customFooterStyle
\patchcmd{\ps@customFooterStyle}{\thepage}{
    \color{gray}\textit{\small <<design.page_numbering_style|replace_placeholders_with_actual_values(page_numbering_style_placeholders)>>}
}{}{} % replace number by desired string
\makeatother
\pagestyle{customFooterStyle}
((* endif *))

\titleformat{\section}{
    % avoid page braking right after the section title
    \needspace{4\baselineskip}
    % make the font size of the section title large and color it with the primary color
    \Large\color{primaryColor}
}{
}{
}{
    % print bold title, give 0.15 cm space and draw a line of 0.8 pt thickness
    % from the end of the title to the end of the body
    \textbf{#1}\hspace{0.15cm}\titlerule[0.8pt]\hspace{-0.1cm}
}[] % section title formatting

\titlespacing{\section}{
    % left space:
    -1pt
}{
    % top space:
    <<design.margins.section_title.top>>
}{
    % bottom space:
    <<design.margins.section_title.bottom>>
} % section title spacing

\newenvironment{highlights}{
    \begin{itemize}[
        topsep=<<design.margins.highlights_area.top>>,
        parsep=<<design.margins.highlights_area.vertical_between_bullet_points>>,
        partopsep=0pt,
        itemsep=0pt,
        leftmargin=<<design.margins.highlights_area.left>> + 10pt
    ]
}{
    \end{itemize}
            
    \vspace{-0.20cm}
} % new environment for highlights


\newenvironment{onecolentry}{
    \begin{adjustwidth}{
        <<design.margins.entry_area.left_and_right>> + 0.00001 cm
    }{
        <<design.margins.entry_area.left_and_right>> + 0.00001 cm
    }
}{
    \end{adjustwidth}
} % new environment for one column entries

\newenvironment{twocolentry}[2][]{
    \onecolentry
    \def\secondColumn{#2}
    \setcolumnwidth{\fill, <<design.margins.entry_area.date_and_location_width>>}
    \begin{paracol}{2}
}{
    \switchcolumn \raggedleft \secondColumn
    \end{paracol}
    \endonecolentry
} % new environment for two column entries

\newenvironment{threecolentry}[3][]{
    \onecolentry
    \def\thirdColumn{#3}
    \setcolumnwidth{1cm, \fill, <<design.margins.entry_area.date_and_location_width>>}
    \begin{paracol}{3}
    \raggedright #2 \switchcolumn
}{
    \switchcolumn \raggedleft \thirdColumn
    \end{paracol}
    \endonecolentry
} % new environment for three column entries

\newenvironment{header}{
    \setlength{\topsep}{0pt}\par\kern\topsep\centering\color{primaryColor}\linespread{1.5}
}{
    \par\kern\topsep
} % new environment for the header

((* set last_updated_date_style_placeholders = {
    "TODAY": today,
} *))
\newcommand{\placelastupdatedtext}{% \placetextbox{<horizontal pos>}{<vertical pos>}{<stuff>}
  \AddToShipoutPictureFG*{% Add <stuff> to current page foreground
    \put(
        \LenToUnit{\paperwidth-<<design.margins.page.right>>-<<design.margins.entry_area.left_and_right>>+0.05cm},
        \LenToUnit{\paperheight-<<design.margins.page.top|divide_length_by(2)>>}
    ){\vtop{{\null}\makebox[0pt][c]{
        \small\color{gray}\textit{<<design.last_updated_date_style|replace_placeholders_with_actual_values(last_updated_date_style_placeholders)>>}\hspace{\widthof{<<design.last_updated_date_style|replace_placeholders_with_actual_values(last_updated_date_style_placeholders)>>}}
    }}}%
  }%
}%

% save the original href command in a new command:
\let\hrefWithoutArrow\href
 % new command for external links:
\renewcommand{\href}[2]{\hrefWithoutArrow{#1}{\mbox{\ifthenelse{\equal{#2}{}}{ }{#2 }\raisebox{.15ex}{\footnotesize \faExternalLink*}}}}