Templates have counterintuitive behavior with unbalanced HTML
I just solved an issue with my own Hakyll site where a superfluous closing tag (</li>) in a template caused Hakyll to silently move some closing div and ul tags (or something to that effect). Basically this:
Template:
<div>
<ul>
<li>
<div>
List item one has an extra closing tag </li>
</div>
</li>
<li>
<div>
List item two
</div>
</li>
</ul>
</div>
Final HTML
<div>
<ul>
<li>
<div>
List item one has an extra closing tag
</div>
</li>
</ul>
</div>
<li>
<div>
List item two
</div>
</li>
(This template was called with applyAsTemplate, but I deleted all references to variables to produce this MWE).
Obviously this is user error, but the issue is that this is the first time I noticed that the template system is not HTML-agnostic. Naturally I assumed the behavior was being caused by Pandoc, since my real site is more complicated than this.
Should the template system behave this way? If so, perhaps the Hakyll tutorial could add a mild warning that templates are sensitive to bad HTML?
The templating system is HTML-agnostic. Yes, it probably was caused by Pandoc, or even by your browser if the "Final HTML" comes from the DOM tree of your devtools?