feat: experimental katex integration

This commit is contained in:
Laurent Fainsin 2022-02-01 20:33:56 +01:00
parent 98f691480a
commit 57f9229d42
4 changed files with 112 additions and 3 deletions

View file

@ -11,7 +11,7 @@ const sass = require("sass");
const fs = require("fs");
const markdownLib = markdownIt({
html: true,
breaks: true,
breaks: false,
linkify: true,
}).use(markdownItAttrs);

84
src/_includes/test.njk Normal file
View file

@ -0,0 +1,84 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" type="image/x-icon" href="{{ '/favicon.png' | url }}">
<script>
{% include "javascript/chaffle.min.js" %}
</script>
<title>{{ username }}</title>
<style>
{% include "css/style.css" %}
{% include "css/anim.css" %}
</style>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.15.2/dist/katex.min.css" integrity="sha384-MlJdn/WNKDGXveldHDdyRP1R4CTHr3FeuDNfhsLPYrq2t0UBkUdK2jyTnXPEK1NQ" crossorigin="anonymous">
<!-- The loading of KaTeX is deferred to speed up page rendering -->
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.2/dist/katex.min.js" integrity="sha384-VQ8d8WVFw0yHhCk5E8I86oOhv48xLpnDZx5T9GogA/Y84DcCKWXDmSDfn13bzFZY" crossorigin="anonymous"></script>
<!-- To automatically render math in text elements, include the auto-render extension: -->
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.2/dist/contrib/auto-render.min.js" integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR" 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},
{left: '\\(', right: '\\)', display: false},
{left: '\\[', right: '\\]', display: true}
],
// • rendering keys, e.g.:
throwOnError : false
});
});
</script>
</head>
<body>
<header role="banner">
<div id="username">
<span data-chaffle-onload="" data-chaffle="en">{{ username }}</span>
<i class="blink">_</i>
</div>
{% block header %}{% endblock header %}
</header>
<main role="main">
{{ content | safe }}
</main>
<script>
var elm_mouseover = document.querySelectorAll('[data-chaffle]');
var elm_onload = document.querySelectorAll('[data-chaffle-onLoad]');
Array
.prototype
.forEach
.call(elm_mouseover, function (el) {
var chaffle = new Chaffle(el)
el.addEventListener('mouseover', function () {
chaffle.init();
});
});
Array
.prototype
.forEach
.call(elm_onload, function (el) {
var chaffle = new Chaffle(el)
chaffle.init();
setInterval(function () {
chaffle.init();
}, 10000)
});
</script>
</body>
</html>

25
src/test/index.md Normal file
View file

@ -0,0 +1,25 @@
---
layout: test.njk
---
# Analyse des EDP et méthode des éléments finis
> **_Exemple_**
> $$
> (P):
> \left\lbrace
> \begin{array}{l}
> u'(x) + c(x) + u(x) = f(x) \quad & \forall x \in \Omega \\
> u(x) = 0 & \forall x \in \Gamma
> \end{array}
> \right.
> $$
> avec $c$, $f$ régulière
> **_EDP 1A_** \
> On cherche $u \in C^4$ une solution de $(P)$ dans des espace fonctionnels pour lequel $f$ est "strictement" régulier. \
> Par différence finie: $u''(x_i) \simeq \dfrac{u_{i+1} - 2u_i + u_{i-1}}{h^2}$ sur une suite régulière de pas $h$.
> **_EDP 2A_** \
> $c$, $f$ dans des espace fonctionnels $(L^\infty(\Omega), L^2(\Omega), ...)$.
> On cherchera $u \in V$ tel que $\forall v \in V$ $\displaystyle\int_{-\infty}^\infty\hat f(\xi) e^{2 \pi i \xi x} d\xi$