format:
  pdf:
#    links-as-notes: true
    colorlinks: false
    pdf-engine: lualatex
    documentclass: scrartcl
    classoption:
    - DIV=calc
    - twocolumn
    csquotes: true
    papersize: a4
#    extract-media: img

    include-in-header:
# recalculate page margins, since mainfont was set after documentclass
    - text: |
        \KOMAoptions{DIV=last}
# avoid widow or orphan lines
    - text: |
        \usepackage[defaultlines=4,all]{nowidow}
# set page footer to danish page count "side X af Y"
    - text: |
        \usepackage{lastpage}
        \usepackage{scrlayer-scrpage}
        \cfoot{side \thepage\ af \pageref{LastPage}}
# balance columns on last page
    - text: |
        \usepackage{pbalance}
# cludge to support markdown tables in twocolumn page layout
    - text: |
        \usepackage{float}
        \makeatletter
        \let\oldlt\longtable
        \let\endoldlt\endlongtable
        \def\longtable{\@ifnextchar[\longtable@i \longtable@ii}
        \def\longtable@i[#1]{\begin{figure}[H]
        \onecolumn
        \begin{minipage}{0.5\textwidth}
        \oldlt[#1]
        }
        \def\longtable@ii{\begin{figure}[H]
        \onecolumn
        \begin{minipage}{0.5\textwidth}
        \oldlt
        }
        \def\endlongtable{\endoldlt
        \end{minipage}
        \twocolumn
        \end{figure}}
        \makeatother

    include-before-content:
# avoid english style of added space after punctuation
    - text: |
        \frenchspacing