Print pagebreaks, inline width images

This commit is contained in:
Vojtěch Struhár 2025-06-07 12:55:02 +02:00
parent 83a00a467a
commit 34f7223b30
5 changed files with 49 additions and 4 deletions

View File

@ -23,6 +23,14 @@ export default defineConfig({
src: "./src/assets/fi_16.png"
},
social: [{ icon: 'github', label: 'GitHub', href: 'https://git.vojtechstruhar.com/Vojta/fi-notes' }],
head: [
{
tag: "script",
attrs: {
src: "/scripts/load-images-before-print.js"
}
}
],
customCss: [
"remark-github-alerts/styles/github-colors-light.css",
"remark-github-alerts/styles/github-colors-dark-class.css",
@ -30,8 +38,9 @@ export default defineConfig({
"katex/dist/katex.min.css",
"./src/styles/theme.css",
"./src/styles/footnotes-fix.css",
"./src/styles/pixelated-logo.css",
"./src/styles/images-adjustment.css",
"./src/styles/scroll-fix.css",
"./src/styles/print-improvements.css",
],
sidebar: [
{

View File

@ -0,0 +1,8 @@
function loadAllImages() {
document.querySelectorAll('img[loading="lazy"]').forEach(img => {
img.setAttribute('loading', 'eager');
});
}
// Before printing (manually or via browser)
window.addEventListener('beforeprint', loadAllImages);

View File

@ -0,0 +1,18 @@
.site-title img {
image-rendering: pixelated;
}
img[alt="width=30%"]:has(+ img) {
width: 30%;
display: inline;
}
img[alt="width=69%"]:has(+ img) {
width: 69%;
display: inline;
}
img[alt="width=49%"] {
width: 49%;
display: inline;
}

View File

@ -1,3 +0,0 @@
.site-title img {
image-rendering: pixelated;
}

View File

@ -0,0 +1,13 @@
@media print {
h2, h3 {
break-after: avoid;
}
li:last-child {
break-before: avoid;
}
p, li {
text-align: justify;
}
}