-
I would like to know what is the most direct way to add some code to the HTML header without redefining/replacing the template. The original solution used a custom template that had its Looking through the documentation, directives don't seem to be the solution (@:include, @:embed seem to replace the whole section, not extend it). Are the render hook the "correct" solution for this hack? TIA <!DOCTYPE html>
<html lang="${?laika.site.metadata.language}">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Laika 0.18.1 + Helium Theme" />
<title>${cursor.currentDocument.title}</title>
...
@:heliumInitPreview(container)
<script> /* for avoiding page load transitions */ </script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" integrity="sha384-vKruj+a13U8yHIkAyGgK1J3ArTLzrFGBbBc0tDp4ad/EyewESeXE/Iv67Aj8gKZ0" crossorigin="anonymous">
<!-- The loading of KaTeX is deferred to speed up page rendering -->
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js" integrity="sha384-PwRUT/YqbnEjkZO0zZxNqcxACrXe+j766U2amXcgMg5457rve2Y7I6ZJSm2A0mS4" crossorigin="anonymous"></script>
<!-- To automatically render math in text elements, include the auto-render extension: -->
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js" integrity="sha384-+VBxd3r6XgURycqtZ117nYw44OOcIax56Z4dCRWbxyPt0Koah1uHoK0o4+/RRE05" crossorigin="anonymous"
onload="renderMathInElement(document.body);"></script>
<script>
document.addEventListener("DOMContentLoaded", function() {
renderMathInElement(document.body, {
// customised options
// • auto-render specific keys, e.g.:
delimiters: [
{left: '$$', right: '$$', display: true},
{left: '$', right: '$', display: false},
],
// • rendering keys, e.g.:
throwOnError : false
});
});
</script>
</head> |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
As far as I can see this would still require a custom template, but at least with 0.19 templates are modularized and you'd only need to replace the head template: https://typelevel.org/Laika/latest/03-preparing-content/03-theme-settings.html#global-overrides. |
Beta Was this translation helpful? Give feedback.
As far as I can see this would still require a custom template, but at least with 0.19 templates are modularized and you'd only need to replace the head template: https://typelevel.org/Laika/latest/03-preparing-content/03-theme-settings.html#global-overrides.
That template is a mere 27 lines, so it's somewhat less of a hassle to keep in sync with the official one.