<!doctype html>
<html lang="{{ site.language | default('en') }}">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1"
/>
<title>
{% block title %}{{ site.title }}{% endblock %}
</title>
<meta
name="description"
content="{% block description %}{{ description }}{% endblock %}"
/>
<meta
property="og:title"
content="{% block og_title %}{{ site.title }}{% endblock %}"
/>
<meta
property="og:description"
content="{{ description }}"
/>
<meta
property="og:url"
content="{{ canonical_url | safe }}"
/>
<meta
property="og:type"
content="{% block og_type %}website{% endblock %}"
/>
<meta
property="og:site_name"
content="{{ site.title }}"
/>
<meta name="twitter:card" content="summary" />
<meta
name="twitter:title"
content="{% block twitter_title %}{{ site.title }}{% endblock %}"
/>
<meta
name="twitter:description"
content="{{ description }}"
/>
<meta
name="view-transition"
content="same-origin"
/>
<link rel="stylesheet" href="/static/style.css" />
<link
rel="alternate"
type="application/rss+xml"
title="{{ site.title }}"
href="/feed.xml"
/>
{% if favicon %}
<link
rel="icon"
href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>{{ favicon }}</text></svg>"
/>
{% endif %} {% if analytics is defined and
analytics.snippet %} {{ analytics.snippet | safe }}
{% elif analytics is defined and
analytics.plausible_domain %}
<script
defer
data-domain="{{ analytics.plausible_domain }}"
src="{{ analytics.plausible_script | safe }}"
></script>
{% endif %}
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css"
/>
</head>
<body>
{% include "partials/nav.html" %}
<div class="layout">
<main class="main-content">
{% block content %}{% endblock %}
</main>
</div>
{% if search is defined and search.enabled |
default(true) %}
<script src="/static/search.js" defer></script>
{% endif %}
<script
defer
src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js"
></script>
<script
defer
src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/auto-render.min.js"
></script>
<script>
document.addEventListener(
"DOMContentLoaded",
function () {
// Unescape HTML entities inside math delimiters before KaTeX processes them
// comrak escapes > to >, < to <, etc. which breaks LaTeX
var content =
document.querySelector(
".main-content",
);
if (!content) return;
var walker = document.createTreeWalker(
content,
NodeFilter.SHOW_TEXT,
null,
false,
);
while (walker.nextNode()) {
var node = walker.currentNode;
if (
node.nodeValue &&
/\$/.test(node.nodeValue)
) {
var text = node.nodeValue;
// Fix HTML entities inside $...$ and
$$...$$
text = text.replace(
/\$\$([^$]+)\$\$/g,
function (m, inner) {
return (
"
$$" +
inner
.replace(
/>/g,
">",
)
.replace(
/</g,
"<",
)
.replace(
/&/g,
"&",
) +
"$$
"
);
},
);
text = text.replace(
/\$([^$]+)\$/g,
function (m, inner) {
return (
"$" +
inner
.replace(
/>/g,
">",
)
.replace(
/</g,
"<",
)
.replace(
/&/g,
"&",
) +
"$"
);
},
);
if (text !== node.nodeValue) {
node.nodeValue = text;
}
}
}
// Now render math
if (
typeof renderMathInElement ===
"function"
) {
renderMathInElement(content, {
delimiters: [
{
left: "
$$",
right: "$$
",
display: true,
},
{
left: "$",
right: "$",
display: false,
},
],
ignoredTags: [
"script",
"noscript",
"style",
"textarea",
"pre",
"code",
"a",
],
throwOnError: false,
});
}
},
);
</script>
<script>
// Smooth page transition fallback for browsers without View Transitions API
(function () {
if (document.startViewTransition) return; // native support, no need for fallback
document.addEventListener(
"click",
function (e) {
var link = e.target.closest("a");
if (!link || !link.href) return;
if (
link.target === "_blank" ||
link.hasAttribute("download")
)
return;
if (
e.ctrlKey ||
e.metaKey ||
e.shiftKey
)
return;
try {
var url = new URL(link.href);
if (
url.origin !==
location.origin
)
return;
} catch (err) {
return;
}
var content =
document.querySelector(
".main-content",
);
if (!content) return;
e.preventDefault();
content.classList.add("navigating");
setTimeout(function () {
window.location.href =
link.href;
}, 150);
},
);
})();
</script>
</body>
</html>
render/templates/base.html
ฯ 0.0%