\Preamble{xhtml,html5,mathml,2,sec-filename,info,fn-in,fonts}
% Logical elements
\NewLogicalBlock{codesample}
\SetTag{codesample}{figure}
\SetBlockProperty{codesample}{role}{doc-example}% set dPub property
\NewLogicalBlock{acknowledgements}
\SetTag{acknowledgements}{section}
\SetBlockProperty{acknowledgements}{role}{doc-acknowledgements}
\NewLogicalBlock{warning}
\SetTag{warning}{section}
\SetBlockProperty{warning}{role}{doc-notice}
% external stylesheet
\Configure{AddCss}{style.css}
% Declare graphics extensions
\DeclareGraphicsExtensions{.svg,.png,.jpg}
\makeatletter
\ExplSyntaxOn
\Configure{Gin-dim}{style="width:\fp_eval:n{round(\Gin@req@width/\textwidth*100,2)}\%"}
\ExplSyntaxOff
\makeatother
% Mini TOC
\Configure{crosslinks+}{%
\bgroup
% container for the page toc
\Configure{tableofcontents}{\IgnorePar\EndP\HCode{\Hnewline}\ShowPar}{}{}%
\TableOfContents[chapter,section,subsection]% Print table of contents before crosslinks
\egroup
\ifvmode\IgnorePar\fi\EndP%
\HCode{\Hnewline\Hnewline}}
{\ifvmode\IgnorePar\fi\EndP%
\HCode{}}{}{}
% configuration for TOC on the main page
\Configure{tableofcontents}{\IgnorePar\EndP\HCode{\Hnewline\Hnewline}\ShowPar}{}{}%
% close the element started in \Configure{crosslinks+}
\Configure{@/BODY}{\ifvmode\IgnorePar\fi\EndP\HCode{}}
% Goatcounter counting
\Configure{@/BODY}{\HCode{\Hnewline }}
% show only crosslinks to prev, main and next pages
\Configure{crosslinks*}{prev}{up}{next}{}
% use normal space instead of non-breaking space
\Configure{ }{ }
\Configure{texttt}{\HCode{}\NoFonts}{\EndNoFonts\HCode{}}
\Configure{verb}{\HCode{}\NoFonts}{\EndNoFonts\HCode{}}
\ConfigureEnv{texsource}{\BlockElementStart{codesample}{class="texsource"}\NoFonts\fontencoding{OT1}}{\EndNoFonts\BlockElementEnd{codesample}{}}{}{}
\ConfigureEnv{shellcommand}{\BlockElementStart{codesample}{class="shellcommand"}\NoFonts\fontencoding{OT1}}{\EndNoFonts\BlockElementEnd{codesample}{}}{}{}
\ConfigureEnv{htmlsource}{\BlockElementStart{codesample}{class="htmlsource"}\NoFonts\fontencoding{OT1}}{\EndNoFonts\BlockElementEnd{codesample}{}}{}{}
\ConfigureEnv{luasource}{\BlockElementStart{codesample}{class="luasource"}\NoFonts\fontencoding{OT1}}{\EndNoFonts\BlockElementEnd{codesample}{}}{}{}
\ConfigureEnv{textsource}{\BlockElementStart{codesample}{class="textsource"}\NoFonts\fontencoding{OT1}}{\EndNoFonts\BlockElementEnd{codesample}{}}{}{}
\Configure{htmlinput}{\BlockElementStart{codesample}{class="htmlsource"}}{\BlockElementEnd{codesample}{}}
\Configure{texinput}{\BlockElementStart{codesample}{class="texsource"}}{\BlockElementEnd{codesample}{}}
\ConfigureEnv{acknowledgements}{\BlockElementStart{acknowledgements}{}}{\BlockElementEnd{acknowledgements}{}}{}{}
\ConfigureEnv{warning}{\BlockElementStart{warning}{}}{\BlockElementEnd{warning}{}}{}{}
\begin{document}
\EndPreamble