mirror of
https://github.com/andwati/pwnforfunandprofit.xyz.git
synced 2026-12-06 15:18:54 +00:00
feat: Add KaTeX for mathematical rendering, Mermaid for diagrams, and custom fonts.
This commit is contained in:
@@ -19,13 +19,11 @@
|
||||
- [ ] Easy-to-use and self-expanding table of contents
|
||||
- [ ] Beautiful CSS animation
|
||||
- [ ] Brand new Page Layout optimized for wide screens
|
||||
- [ ] Compatibility for PWA
|
||||
- [ ] Social and Comment Systems
|
||||
|
||||
- [ ] Local Avatar supported
|
||||
- [ ] social links supported
|
||||
- [ ] share sites supported
|
||||
|
||||
- [ ] Utterances comment system supported by Utterances
|
||||
|
||||
|
||||
@@ -34,15 +32,9 @@
|
||||
- [ ] Twemoji supported
|
||||
- [ ] Automatically highlighting code
|
||||
- [ ] Copy code to clipboard with one click
|
||||
- [ ] Extended Markdown syntax for Font Awesome icons
|
||||
- [ ] Extended Markdown syntax for fraction
|
||||
- [ ] Mathematical formula supported by KaTeX
|
||||
- [ ] Diagrams shortcode supported by mermaid
|
||||
- [ ] Interactive data visualization shortcode supported by ECharts
|
||||
- [ ] Mapbox shortcode supported by Mapbox GL JS
|
||||
|
||||
|
||||
- [ ] Animated typing supported by TypeIt
|
||||
- [ ] Dynamic scroll supported by native CSS
|
||||
- [ ] Cookie consent banner supported by cookieconsent
|
||||
- [ ] Option to cache remote images
|
||||
+85
-2
@@ -115,13 +115,14 @@ pre code {
|
||||
|
||||
// Component: Header
|
||||
.site-header {
|
||||
padding: 2rem 0;
|
||||
padding: 1.25rem 0;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 50;
|
||||
background-color: rgba(var(--bg-color), 0.8);
|
||||
background-color: var(--bg-color);
|
||||
backdrop-filter: blur(12px);
|
||||
-webkit-backdrop-filter: blur(12px);
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
}
|
||||
|
||||
.nav-container {
|
||||
@@ -130,6 +131,88 @@ pre code {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
// Right side wrapper (links + controls)
|
||||
.nav-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
// Always-visible icon controls
|
||||
.nav-controls {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.search-toggle {
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--text-color);
|
||||
cursor: pointer;
|
||||
padding: 0.35rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 50%;
|
||||
transition: var(--transition-smooth);
|
||||
&:hover { color: var(--accent-color); }
|
||||
}
|
||||
|
||||
// Hamburger button — hidden on desktop, shown on mobile
|
||||
.nav-toggle {
|
||||
display: none;
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--text-color);
|
||||
cursor: pointer;
|
||||
padding: 0.25rem;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.close-icon { display: none; }
|
||||
|
||||
&[aria-expanded="true"] {
|
||||
.hamburger-icon { display: none; }
|
||||
.close-icon { display: block; }
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.nav-toggle {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.nav-right {
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.nav-links {
|
||||
display: none !important;
|
||||
flex-direction: column !important;
|
||||
align-items: flex-start !important;
|
||||
gap: 0 !important;
|
||||
width: 100%;
|
||||
order: 10; // push below nav-controls
|
||||
padding: 1rem 0;
|
||||
border-top: 1px solid var(--border-color);
|
||||
margin-top: 0.5rem;
|
||||
|
||||
&.is-open {
|
||||
display: flex !important;
|
||||
}
|
||||
|
||||
.nav-item {
|
||||
width: 100%;
|
||||
padding: 0.75rem 0;
|
||||
font-size: 1rem;
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
&::after { display: none; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.brand-text {
|
||||
font-weight: 700;
|
||||
font-size: 1.2rem;
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
/* Outfit */
|
||||
@font-face {
|
||||
font-family: 'Outfit';
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
font-display: swap;
|
||||
src: url('../fonts/outfit/outfit-v15-latin-300.woff2') format('woff2');
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Outfit';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: url('../fonts/outfit/outfit-v15-latin-regular.woff2') format('woff2');
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Outfit';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
font-display: swap;
|
||||
src: url('../fonts/outfit/outfit-v15-latin-500.woff2') format('woff2');
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Outfit';
|
||||
font-style: normal;
|
||||
font-weight: 600;
|
||||
font-display: swap;
|
||||
src: url('../fonts/outfit/outfit-v15-latin-600.woff2') format('woff2');
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Outfit';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: url('../fonts/outfit/outfit-v15-latin-700.woff2') format('woff2');
|
||||
}
|
||||
|
||||
/* JetBrains Mono */
|
||||
@font-face {
|
||||
font-family: 'JetBrains Mono';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: url('../fonts/jetbrains-mono/jetbrains-mono-v24-latin-regular.woff2') format('woff2');
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'JetBrains Mono';
|
||||
font-style: italic;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: url('../fonts/jetbrains-mono/jetbrains-mono-v24-latin-italic.woff2') format('woff2');
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'JetBrains Mono';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: url('../fonts/jetbrains-mono/jetbrains-mono-v24-latin-700.woff2') format('woff2');
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Vendored
+1
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Vendored
+1
@@ -0,0 +1 @@
|
||||
!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}()}));
|
||||
Vendored
+1
File diff suppressed because one or more lines are too long
Vendored
+2029
File diff suppressed because one or more lines are too long
+20
-1
@@ -24,7 +24,26 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
if (htmlElement.classList.contains('dark')) {
|
||||
theme = 'dark';
|
||||
}
|
||||
localStorage.setItem('theme', theme);
|
||||
localStorage.setItem('theme', theme);
|
||||
});
|
||||
}
|
||||
|
||||
// Mobile nav toggle
|
||||
const navToggle = document.getElementById('nav-toggle');
|
||||
const navLinks = document.getElementById('nav-links');
|
||||
|
||||
if (navToggle && navLinks) {
|
||||
navToggle.addEventListener('click', () => {
|
||||
const isOpen = navLinks.classList.toggle('is-open');
|
||||
navToggle.setAttribute('aria-expanded', isOpen);
|
||||
});
|
||||
|
||||
// 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');
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
+25
-21
@@ -31,11 +31,8 @@
|
||||
<link rel="stylesheet" href="{{ get_url(path="main.css") }}">
|
||||
<link rel="stylesheet" href="{{ get_url(path="css/syntax.css") }}">
|
||||
|
||||
<!-- Fonts -->
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,400;0,700;1,400&display=swap" rel="stylesheet">
|
||||
<!-- Fonts (self-hosted) -->
|
||||
<link rel="stylesheet" href="{{ get_url(path="css/fonts.css") }}">
|
||||
|
||||
{% block head %}{% endblock head %}
|
||||
</head>
|
||||
@@ -46,22 +43,29 @@
|
||||
<a href="{{ get_url(path="") }}" class="brand-link">
|
||||
<span class="brand-text">{{ config.title | default(value="pwna4profit") }}</span>
|
||||
</a>
|
||||
<div class="nav-links" style="display: flex; align-items: center; gap: 1.25rem;">
|
||||
<a href="{{ get_url(path="/about/") }}" class="nav-item">About</a>
|
||||
<a href="{{ get_url(path="/posts") }}" class="nav-item">Posts</a>
|
||||
<a href="{{ get_url(path="/tags/") }}" class="nav-item">Tags</a>
|
||||
<a href="{{ get_url(path="@/archive/_index.md") }}" class="nav-item">Archive</a>
|
||||
|
||||
<span class="nav-separator" style="color: var(--text-muted); opacity: 0.5; margin: 0 -0.25rem;">|</span>
|
||||
|
||||
<button class="search-toggle hover-scale" aria-label="Search" style="background: none; border: none; color: inherit; cursor: pointer; display: flex; align-items: center; padding: 0;">
|
||||
<svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>
|
||||
</button>
|
||||
|
||||
<button id="theme-toggle" class="theme-toggle hover-scale" aria-label="Toggle Dark Mode" style="padding: 0; display: flex; align-items: center;">
|
||||
<svg class="sun-icon" viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><path d="M12 2a10 10 0 0 0 0 20z" fill="currentColor"></path></svg>
|
||||
<svg class="moon-icon" viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><path d="M12 2a10 10 0 0 0 0 20z" fill="currentColor"></path></svg>
|
||||
</button>
|
||||
|
||||
<div class="nav-right">
|
||||
<!-- Collapsible links -->
|
||||
<div id="nav-links" class="nav-links">
|
||||
<a href="{{ get_url(path="/about/") }}" class="nav-item">About</a>
|
||||
<a href="{{ get_url(path="/posts") }}" class="nav-item">Posts</a>
|
||||
<a href="{{ get_url(path="/tags/") }}" class="nav-item">Tags</a>
|
||||
<a href="{{ get_url(path="@/archive/_index.md") }}" class="nav-item">Archive</a>
|
||||
</div>
|
||||
|
||||
<div class="nav-controls">
|
||||
<button class="search-toggle" aria-label="Search">
|
||||
<svg viewBox="0 0 24 24" width="18" height="18" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>
|
||||
</button>
|
||||
<button id="theme-toggle" class="theme-toggle hover-scale" aria-label="Toggle Dark Mode">
|
||||
<svg class="sun-icon" viewBox="0 0 24 24" width="18" height="18" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><path d="M12 2a10 10 0 0 0 0 20z" fill="currentColor"></path></svg>
|
||||
<svg class="moon-icon" viewBox="0 0 24 24" width="18" height="18" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><path d="M12 2a10 10 0 0 0 0 20z" fill="currentColor"></path></svg>
|
||||
</button>
|
||||
<button id="nav-toggle" class="nav-toggle" aria-label="Toggle navigation" aria-expanded="false">
|
||||
<svg class="hamburger-icon" viewBox="0 0 24 24" width="22" height="22" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round"><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="12" x2="21" y2="12"/><line x1="3" y1="18" x2="21" y2="18"/></svg>
|
||||
<svg class="close-icon" viewBox="0 0 24 24" width="22" height="22" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
+9
-7
@@ -19,15 +19,15 @@
|
||||
|
||||
<!-- Optional features from README -->
|
||||
{% if page.extra.math %}
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css">
|
||||
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js"></script>
|
||||
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js"
|
||||
<link rel="stylesheet" href="{{ get_url(path="css/katex/katex.min.css") }}">
|
||||
<script defer src="{{ get_url(path="js/katex/katex.min.js") }}"></script>
|
||||
<script defer src="{{ get_url(path="js/katex/auto-render.min.js") }}"
|
||||
onload="renderMathInElement(document.body);"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if page.extra.mermaid %}
|
||||
<script type="module">
|
||||
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
|
||||
import mermaid from '{{ get_url(path="js/mermaid.min.js") }}';
|
||||
mermaid.initialize({ startOnLoad: true, theme: 'dark' });
|
||||
</script>
|
||||
{% endif %}
|
||||
@@ -78,16 +78,18 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<!-- Utterances comments -->
|
||||
<div class="comments" id="comments">
|
||||
<!-- Utterances comments (posts only) -->
|
||||
{% if page.path is starting_with("posts/") %}
|
||||
<div class="comments" id="comments" style="margin-top: 4rem;">
|
||||
<script src="https://utteranc.es/client.js"
|
||||
repo="andwati/pwnforfunandprofit"
|
||||
repo="andwati/pwnforfunandprofit.xyz"
|
||||
issue-term="pathname"
|
||||
theme="github-dark"
|
||||
crossorigin="anonymous"
|
||||
async>
|
||||
</script>
|
||||
</div>
|
||||
{% endif %}
|
||||
</footer>
|
||||
</article>
|
||||
{% endblock content %}
|
||||
|
||||
Reference in New Issue
Block a user