feat: Establish CI pipeline, pre-commit hooks, and code quality linting for improved developer experience.

This commit is contained in:
2026-03-11 20:51:35 +03:00
parent c0e261c2ed
commit 187c8eb078
49 changed files with 208356 additions and 1216 deletions
File diff suppressed because one or more lines are too long
+1128 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+41 -39
View File
@@ -1,50 +1,52 @@
document.addEventListener('DOMContentLoaded', () => {
// Select all <pre> elements that contain code blocks
const preBlocks = document.querySelectorAll('pre');
// Select all <pre> elements that contain code blocks
const preBlocks = document.querySelectorAll('pre');
const copyIcon = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/></svg>';
const checkIcon = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg>';
const copyIcon =
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/></svg>';
const checkIcon =
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg>';
preBlocks.forEach((pre) => {
// Create the copy button
const button = document.createElement('button');
button.innerHTML = copyIcon;
button.className = 'copy-code-btn';
button.setAttribute('aria-label', 'Copy code');
button.setAttribute('title', 'Copy code');
preBlocks.forEach((pre) => {
// Create the copy button
const button = document.createElement('button');
button.innerHTML = copyIcon;
button.className = 'copy-code-btn';
button.setAttribute('aria-label', 'Copy code');
button.setAttribute('title', 'Copy code');
// Add the button to the <pre> block
// Assuming pre is position relative in CSS
pre.appendChild(button);
// Add the button to the <pre> block
// Assuming pre is position relative in CSS
pre.appendChild(button);
button.addEventListener('click', async () => {
// Find the <code> element within the <pre>
const code = pre.querySelector('code');
if (!code) return;
button.addEventListener('click', async () => {
// Find the <code> element within the <pre>
const code = pre.querySelector('code');
if (!code) return;
// Get the text content, removing any leading/trailing whitespace
const text = code.innerText;
// Get the text content, removing any leading/trailing whitespace
const text = code.innerText;
try {
// Wait for the clipboard API
await navigator.clipboard.writeText(text);
try {
// Wait for the clipboard API
await navigator.clipboard.writeText(text);
// Add visual feedback
button.innerHTML = checkIcon;
button.classList.add('copied');
button.setAttribute('aria-label', 'Copied');
button.setAttribute('title', 'Copied!');
// Add visual feedback
button.innerHTML = checkIcon;
button.classList.add('copied');
button.setAttribute('aria-label', 'Copied');
button.setAttribute('title', 'Copied!');
// Revert back after 2 seconds
setTimeout(() => {
button.innerHTML = copyIcon;
button.classList.remove('copied');
button.setAttribute('aria-label', 'Copy code');
button.setAttribute('title', 'Copy code');
}, 2000);
} catch (err) {
console.error('Failed to copy code: ', err);
}
});
// Revert back after 2 seconds
setTimeout(() => {
button.innerHTML = copyIcon;
button.classList.remove('copied');
button.setAttribute('aria-label', 'Copy code');
button.setAttribute('title', 'Copy code');
}, 2000);
} catch (err) {
console.error('Failed to copy code: ', err);
}
});
});
});
+170 -1
View File
@@ -1 +1,170 @@
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("katex")):"function"==typeof define&&define.amd?define(["katex"],t):"object"==typeof exports?exports.renderMathInElement=t(require("katex")):e.renderMathInElement=t(e.katex)}("undefined"!=typeof self?self:this,(function(e){return function(){"use strict";var t={771:function(t){t.exports=e}},r={};function n(e){var i=r[e];if(void 0!==i)return i.exports;var a=r[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var i={};return function(){n.d(i,{default:function(){return s}});var e=n(771),t=n.n(e),r=function(e,t,r){for(var n=r,i=0,a=e.length;n<t.length;){var o=t[n];if(i<=0&&t.slice(n,n+a)===e)return n;"\\"===o?n++:"{"===o?i++:"}"===o&&i--,n++}return-1},a=/^\\begin{/,o=function(e,t){for(var n,i=[],o=new RegExp("("+t.map((function(e){return e.left.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")})).join("|")+")");-1!==(n=e.search(o));){n>0&&(i.push({type:"text",data:e.slice(0,n)}),e=e.slice(n));var l=t.findIndex((function(t){return e.startsWith(t.left)}));if(-1===(n=r(t[l].right,e,t[l].left.length)))break;var d=e.slice(0,n+t[l].right.length),s=a.test(d)?d:e.slice(t[l].left.length,n);i.push({type:"math",data:s,rawData:d,display:t[l].display}),e=e.slice(n+t[l].right.length)}return""!==e&&i.push({type:"text",data:e}),i},l=function(e,r){var n=o(e,r.delimiters);if(1===n.length&&"text"===n[0].type)return null;for(var i=document.createDocumentFragment(),a=0;a<n.length;a++)if("text"===n[a].type)i.appendChild(document.createTextNode(n[a].data));else{var l=document.createElement("span"),d=n[a].data;r.displayMode=n[a].display;try{r.preProcess&&(d=r.preProcess(d)),t().render(d,l,r)}catch(e){if(!(e instanceof t().ParseError))throw e;r.errorCallback("KaTeX auto-render: Failed to parse `"+n[a].data+"` with ",e),i.appendChild(document.createTextNode(n[a].rawData));continue}i.appendChild(l)}return i},d=function e(t,r){for(var n=0;n<t.childNodes.length;n++){var i=t.childNodes[n];if(3===i.nodeType){for(var a=i.textContent,o=i.nextSibling,d=0;o&&o.nodeType===Node.TEXT_NODE;)a+=o.textContent,o=o.nextSibling,d++;var s=l(a,r);if(s){for(var f=0;f<d;f++)i.nextSibling.remove();n+=s.childNodes.length-1,t.replaceChild(s,i)}else n+=d}else 1===i.nodeType&&function(){var t=" "+i.className+" ";-1===r.ignoredTags.indexOf(i.nodeName.toLowerCase())&&r.ignoredClasses.every((function(e){return-1===t.indexOf(" "+e+" ")}))&&e(i,r)}()}},s=function(e,t){if(!e)throw new Error("No element provided to render");var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]=t[n]);r.delimiters=r.delimiters||[{left:"$$",right:"$$",display:!0},{left:"\\(",right:"\\)",display:!1},{left:"\\begin{equation}",right:"\\end{equation}",display:!0},{left:"\\begin{align}",right:"\\end{align}",display:!0},{left:"\\begin{alignat}",right:"\\end{alignat}",display:!0},{left:"\\begin{gather}",right:"\\end{gather}",display:!0},{left:"\\begin{CD}",right:"\\end{CD}",display:!0},{left:"\\[",right:"\\]",display:!0}],r.ignoredTags=r.ignoredTags||["script","noscript","style","textarea","pre","code","option"],r.ignoredClasses=r.ignoredClasses||[],r.errorCallback=r.errorCallback||console.error,r.macros=r.macros||{},d(e,r)}}(),i=i.default}()}));
!(function (e, t) {
'object' == typeof exports && 'object' == typeof module
? (module.exports = t(require('katex')))
: 'function' == typeof define && define.amd
? define(['katex'], t)
: 'object' == typeof exports
? (exports.renderMathInElement = t(require('katex')))
: (e.renderMathInElement = t(e.katex));
})('undefined' != typeof self ? self : this, function (e) {
return (function () {
'use strict';
var t = {
771: function (t) {
t.exports = e;
},
},
r = {};
function n(e) {
var i = r[e];
if (void 0 !== i) return i.exports;
var a = (r[e] = { exports: {} });
return (t[e](a, a.exports, n), a.exports);
}
((n.n = function (e) {
var t =
e && e.__esModule
? function () {
return e.default;
}
: function () {
return e;
};
return (n.d(t, { a: t }), t);
}),
(n.d = function (e, t) {
for (var r in t)
n.o(t, r) && !n.o(e, r) && Object.defineProperty(e, r, { enumerable: !0, get: t[r] });
}),
(n.o = function (e, t) {
return Object.prototype.hasOwnProperty.call(e, t);
}));
var i = {};
return (
(function () {
n.d(i, {
default: function () {
return s;
},
});
var e = n(771),
t = n.n(e),
r = function (e, t, r) {
for (var n = r, i = 0, a = e.length; n < t.length; ) {
var o = t[n];
if (i <= 0 && t.slice(n, n + a) === e) return n;
('\\' === o ? n++ : '{' === o ? i++ : '}' === o && i--, n++);
}
return -1;
},
a = /^\\begin{/,
o = function (e, t) {
for (
var n,
i = [],
o = new RegExp(
'(' +
t
.map(function (e) {
return e.left.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
})
.join('|') +
')',
);
-1 !== (n = e.search(o));
) {
n > 0 && (i.push({ type: 'text', data: e.slice(0, n) }), (e = e.slice(n)));
var l = t.findIndex(function (t) {
return e.startsWith(t.left);
});
if (-1 === (n = r(t[l].right, e, t[l].left.length))) break;
var d = e.slice(0, n + t[l].right.length),
s = a.test(d) ? d : e.slice(t[l].left.length, n);
(i.push({ type: 'math', data: s, rawData: d, display: t[l].display }),
(e = e.slice(n + t[l].right.length)));
}
return ('' !== e && i.push({ type: 'text', data: e }), i);
},
l = function (e, r) {
var n = o(e, r.delimiters);
if (1 === n.length && 'text' === n[0].type) return null;
for (var i = document.createDocumentFragment(), a = 0; a < n.length; a++)
if ('text' === n[a].type) i.appendChild(document.createTextNode(n[a].data));
else {
var l = document.createElement('span'),
d = n[a].data;
r.displayMode = n[a].display;
try {
(r.preProcess && (d = r.preProcess(d)), t().render(d, l, r));
} catch (e) {
if (!(e instanceof t().ParseError)) throw e;
(r.errorCallback(
'KaTeX auto-render: Failed to parse `' + n[a].data + '` with ',
e,
),
i.appendChild(document.createTextNode(n[a].rawData)));
continue;
}
i.appendChild(l);
}
return i;
},
d = function e(t, r) {
for (var n = 0; n < t.childNodes.length; n++) {
var i = t.childNodes[n];
if (3 === i.nodeType) {
for (
var a = i.textContent, o = i.nextSibling, d = 0;
o && o.nodeType === Node.TEXT_NODE;
)
((a += o.textContent), (o = o.nextSibling), d++);
var s = l(a, r);
if (s) {
for (var f = 0; f < d; f++) i.nextSibling.remove();
((n += s.childNodes.length - 1), t.replaceChild(s, i));
} else n += d;
} else
1 === i.nodeType &&
(function () {
var t = ' ' + i.className + ' ';
-1 === r.ignoredTags.indexOf(i.nodeName.toLowerCase()) &&
r.ignoredClasses.every(function (e) {
return -1 === t.indexOf(' ' + e + ' ');
}) &&
e(i, r);
})();
}
},
s = function (e, t) {
if (!e) throw new Error('No element provided to render');
var r = {};
for (var n in t) t.hasOwnProperty(n) && (r[n] = t[n]);
((r.delimiters = r.delimiters || [
{ left: '$$', right: '$$', display: !0 },
{ left: '\\(', right: '\\)', display: !1 },
{ left: '\\begin{equation}', right: '\\end{equation}', display: !0 },
{ left: '\\begin{align}', right: '\\end{align}', display: !0 },
{ left: '\\begin{alignat}', right: '\\end{alignat}', display: !0 },
{ left: '\\begin{gather}', right: '\\end{gather}', display: !0 },
{ left: '\\begin{CD}', right: '\\end{CD}', display: !0 },
{ left: '\\[', right: '\\]', display: !0 },
]),
(r.ignoredTags = r.ignoredTags || [
'script',
'noscript',
'style',
'textarea',
'pre',
'code',
'option',
]),
(r.ignoredClasses = r.ignoredClasses || []),
(r.errorCallback = r.errorCallback || console.error),
(r.macros = r.macros || {}),
d(e, r));
};
})(),
(i = i.default)
);
})();
});
+11562 -1
View File
File diff suppressed because one or more lines are too long
+190510 -407
View File
File diff suppressed because one or more lines are too long
+53 -51
View File
@@ -1,61 +1,63 @@
document.addEventListener('DOMContentLoaded', () => {
const themeToggleBtn = document.getElementById('theme-toggle');
const htmlElement = document.documentElement;
const themeToggleBtn = document.getElementById('theme-toggle');
const htmlElement = document.documentElement;
const applyTheme = (theme) => {
if (theme === 'dark') {
htmlElement.classList.add('dark');
} else {
htmlElement.classList.remove('dark');
}
localStorage.setItem('theme', theme);
};
// Check local storage for theme preference
const currentTheme = localStorage.getItem('theme');
if (currentTheme === 'dark' || currentTheme === 'light') {
applyTheme(currentTheme);
const applyTheme = (theme) => {
if (theme === 'dark') {
htmlElement.classList.add('dark');
} else {
// Fallback to system preference
const prefersDarkScheme = window.matchMedia('(prefers-color-scheme: dark)');
applyTheme(prefersDarkScheme.matches ? 'dark' : 'light');
htmlElement.classList.remove('dark');
}
localStorage.setItem('theme', theme);
};
// Toggle theme on click
if (themeToggleBtn) {
themeToggleBtn.addEventListener('click', () => {
const nextTheme = htmlElement.classList.contains('dark') ? 'light' : 'dark';
applyTheme(nextTheme);
});
}
// Check local storage for theme preference
const currentTheme = localStorage.getItem('theme');
if (currentTheme === 'dark' || currentTheme === 'light') {
applyTheme(currentTheme);
} else {
// Fallback to system preference
const prefersDarkScheme = window.matchMedia('(prefers-color-scheme: dark)');
applyTheme(prefersDarkScheme.matches ? 'dark' : 'light');
}
// Mobile nav toggle
const navToggle = document.getElementById('nav-toggle');
const navLinks = document.getElementById('nav-links');
// Toggle theme on click
if (themeToggleBtn) {
themeToggleBtn.addEventListener('click', () => {
const nextTheme = htmlElement.classList.contains('dark') ? 'light' : 'dark';
applyTheme(nextTheme);
});
}
if (navToggle && navLinks) {
navToggle.addEventListener('click', () => {
const isOpen = navLinks.classList.toggle('is-open');
navToggle.setAttribute('aria-expanded', isOpen);
});
// Mobile nav toggle
const navToggle = document.getElementById('nav-toggle');
const navLinks = document.getElementById('nav-links');
// Close nav when a link is clicked
navLinks.querySelectorAll('.nav-item').forEach(link => {
link.addEventListener('click', () => {
navLinks.classList.remove('is-open');
navToggle.setAttribute('aria-expanded', 'false');
});
});
}
if (navToggle && navLinks) {
navToggle.addEventListener('click', () => {
const isOpen = navLinks.classList.toggle('is-open');
navToggle.setAttribute('aria-expanded', isOpen);
});
// Sync cookieconsent dark mode reactively with the site theme
const syncCCTheme = () => {
const ccMain = document.getElementById('cc-main');
if (!ccMain) return;
ccMain.classList.toggle('cc--darkmode', htmlElement.classList.contains('dark'));
};
new MutationObserver(syncCCTheme)
.observe(htmlElement, { attributes: true, attributeFilter: ['class'] });
// Initial sync in case banner is already mounted
setTimeout(syncCCTheme, 100);
// Close nav when a link is clicked
navLinks.querySelectorAll('.nav-item').forEach((link) => {
link.addEventListener('click', () => {
navLinks.classList.remove('is-open');
navToggle.setAttribute('aria-expanded', 'false');
});
});
}
// Sync cookieconsent dark mode reactively with the site theme
const syncCCTheme = () => {
const ccMain = document.getElementById('cc-main');
if (!ccMain) return;
ccMain.classList.toggle('cc--darkmode', htmlElement.classList.contains('dark'));
};
new MutationObserver(syncCCTheme).observe(htmlElement, {
attributes: true,
attributeFilter: ['class'],
});
// Initial sync in case banner is already mounted
setTimeout(syncCCTheme, 100);
});