From 700037afe5e3d7e74faef4776ef158f3af34fc02 Mon Sep 17 00:00:00 2001 From: welpo Date: Thu, 6 Jul 2023 01:18:03 +0200 Subject: [PATCH 01/13] =?UTF-8?q?=F0=9F=92=84=20style:=20redesign=20code?= =?UTF-8?q?=20block=20header?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sass/parts/_code.scss | 84 ++++++++----------------------------------- 1 file changed, 15 insertions(+), 69 deletions(-) diff --git a/sass/parts/_code.scss b/sass/parts/_code.scss index 8649d6a..d106877 100644 --- a/sass/parts/_code.scss +++ b/sass/parts/_code.scss @@ -6,12 +6,12 @@ code { } pre { - border: 1px solid var(--border-color); line-height: 1.4; overflow-x: auto; - padding: 1em; + padding: 2rem 1rem 1rem; position: relative; -webkit-overflow-scrolling: touch; + border-radius: 5px; } pre code { @@ -19,6 +19,7 @@ pre code { color: inherit; padding: 0; border: 0; + border-radius: 4px; } pre code[class*="language-"] { @@ -26,74 +27,19 @@ pre code[class*="language-"] { } pre code[class*="language-"]::before { - font-size: 12px; - letter-spacing: 0.025rem; - padding: 0.1rem 0.5rem; + content: attr(data-lang); + display: block; + background-color: var(--primary-color); + color: var(--hover-color); + padding: 0.2rem; + padding-left: 1rem; + font-family: var(--code-font); + width: 100%; + font-size: 0.65rem; + width: 100%; position: absolute; - right: 0.1rem; - margin-top: 0.1rem; - text-align: right; + text-align: left; text-transform: uppercase; top: 0; -} - -pre code[class="language-javaScript"]::before, -pre code[class="language-js"]::before { - content: "js"; - background: #f7df1e; - color: black; -} - -pre code[class*="language-yml"]::before, -pre code[class*="language-yaml"]::before { - content: "yaml"; - background: #C51117; - color: white; -} - -pre code[class*="language-shell"]::before, -pre code[class*="language-bash"]::before, -pre code[class*="language-sh"]::before { - content: "shell"; - background: #33A841; - color: white; -} - -pre code[class*="language-json"]::before { - content: "json"; - color: black; - background: whitesmoke; -} - -pre code[class*="language-python"]::before, -pre code[class*="language-py"]::before { - content: "python"; - background: #306698; - color: #ffd343; -} - -pre code[class*="language-css"]::before { - content: "css"; - background: #215AEF; - color: white; -} - -pre code[class*="language-go"]::before { - content: "Go"; - background: #00ADD8; - color: white; -} - -pre code[class*="language-md"]::before, -pre code[class*="language-md"]::before { - content: "Markdown"; - background: #159ADC; - color: white; -} - -pre code[class*="language-rust"]::before, -pre code[class*="language-rs"]::before { - content: "rust"; - background: #fff8f6; - color: #ff4647; + left: 0; } From 8e1473bba916523f4d1855d4c631e78d603443ba Mon Sep 17 00:00:00 2001 From: welpo Date: Thu, 6 Jul 2023 02:45:54 +0200 Subject: [PATCH 02/13] =?UTF-8?q?=F0=9F=9A=A7=20feat:=20add=20basic=20copy?= =?UTF-8?q?=20button=20to=20codeblocks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sass/parts/_code.scss | 26 +++++++++++++++++++++++++- static/js/copy_button.js | 19 +++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 static/js/copy_button.js diff --git a/sass/parts/_code.scss b/sass/parts/_code.scss index d106877..d68d207 100644 --- a/sass/parts/_code.scss +++ b/sass/parts/_code.scss @@ -6,6 +6,7 @@ code { } pre { + display: block; line-height: 1.4; overflow-x: auto; padding: 2rem 1rem 1rem; @@ -31,7 +32,7 @@ pre code[class*="language-"]::before { display: block; background-color: var(--primary-color); color: var(--hover-color); - padding: 0.2rem; + padding: 0.3rem; padding-left: 1rem; font-family: var(--code-font); width: 100%; @@ -43,3 +44,26 @@ pre code[class*="language-"]::before { top: 0; left: 0; } + +.copy-code { + z-index: 1; + -webkit-mask: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Ik0yMTcuMDAyLTY3LjY5NHEtMzcuNzMyIDAtNjQuMDItMjYuMjg4LTI2LjI4Ny0yNi4yODctMjYuMjg3LTY0LjAxOVYtNzA3LjY5aDc3Ljk5OXY1NDkuNjg5cTAgNC42MTUgMy44NDYgOC40NjIgMy44NDYgMy44NDYgOC40NjIgMy44NDZoNDUxLjY4OXY3Ny45OTlIMjE3LjAwMlptMTc1Ljk5OS0xNzUuOTk5cS0zNy43MzMgMC02NC4wMi0yNi4yODdUMzAyLjY5NC0zMzR2LTQ2My4zODNxMC0zNy43MzIgMjYuMjg3LTY0LjAyIDI2LjI4Ny0yNi4yODcgNjQuMDItMjYuMjg3aDM2NS4zODNxMzcuNzMyIDAgNjQuMDE5IDI2LjI4NyAyNi4yODggMjYuMjg4IDI2LjI4OCA2NC4wMlYtMzM0cTAgMzcuNzMzLTI2LjI4OCA2NC4wMi0yNi4yODcgMjYuMjg3LTY0LjAxOSAyNi4yODdIMzkzLjAwMVptMC03Ny45OThoMzY1LjM4M3E0LjYxNSAwIDguNDYyLTMuODQ3IDMuODQ2LTMuODQ2IDMuODQ2LTguNDYydi00NjMuMzgzcTAtNC42MTYtMy44NDYtOC40NjItMy44NDctMy44NDYtOC40NjItMy44NDZIMzkzLjAwMXEtNC42MTYgMC04LjQ2MiAzLjg0Ni0zLjg0NyAzLjg0Ni0zLjg0NyA4LjQ2MlYtMzM0cTAgNC42MTYgMy44NDcgOC40NjIgMy44NDYgMy44NDcgOC40NjIgMy44NDdabS0xMi4zMDkgMHYtNDg4Vi0zMjEuNjkxWiIvPjwvc3ZnPg==); + // -webkit-mask: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Ik0yMjIuNzgzLTEyNC43ODJxLTQwLjQyNiAwLTY5LjIxMy0yOC43ODgtMjguNzg4LTI4Ljc4Ny0yOC43ODgtNjkuMjEzdi01MTQuNDM0cTAtNDAuNDI2IDI4Ljc4OC02OS4yMTMgMjguNzg3LTI4Ljc4OCA2OS4yMTMtMjguNzg4aDE0OS41MjFxMTEuMzkxLTMyLjY5NiA0MC40MzgtNTMuNzYxIDI5LjA0Ni0yMS4wNjYgNjcuMjU4LTIxLjA2NiAzNi44MjYgMCA2Ni4yODMgMjEuMDY2IDI5LjQ1NyAyMS4wNjUgNDEuNDEzIDUzLjc2MWgxNDkuNTIxcTQwLjQyNiAwIDY5LjIxMyAyOC43ODggMjguNzg4IDI4Ljc4NyAyOC43ODggNjkuMjEzdjUxNC40MzRxMCA0MC40MjYtMjguNzg4IDY5LjIxMy0yOC43ODcgMjguNzg4LTY5LjIxMyAyOC43ODhIMjIyLjc4M1ptMC05OC4wMDFoNTE0LjQzNHYtNTE0LjQzNGgtNjguMDQzdjEyOS4wNDRIMjkwLjgyNnYtMTI5LjA0NGgtNjguMDQzdjUxNC40MzRabTI1Ny4wMDYtNTIyLjkxM3ExNS4yMTEgMCAyNS43MTEtMTAuMjg5IDEwLjUtMTAuMjkgMTAuNS0yNS41IDAtMTUuMjExLTEwLjI4OS0yNS43MTEtMTAuMjktMTAuNS0yNS41LTEwLjUtMTUuMjExIDAtMjUuNzExIDEwLjI5LTEwLjUgMTAuMjg5LTEwLjUgMjUuNSAwIDE1LjIxIDEwLjI4OSAyNS43MSAxMC4yOSAxMC41IDI1LjUgMTAuNVoiLz48L3N2Zz4); + background: var(--hover-color); + cursor: pointer; + display: inline-block; + position: absolute; + height: 20px; + width: 20px; + color: white; + right: 0.5rem; + top: 0.2rem; +} + +.copy-code.checked { + -webkit-mask: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Ik0zOTUtMjUzIDE5NC00NTVsODMtODMgMTE4IDExNyAyODgtMjg3IDgzIDg0LTM3MSAzNzFaIi8+PC9zdmc+); +} + +.copy-code.error { + -webkit-mask: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Ik00NzkuMzg2LTI0OFE1MDktMjQ4IDUyOS0yNjcuMzg2cTIwLTE5LjM4NiAyMC00OVQ1MjkuNjE0LTM2Ni41cS0xOS4zODYtMjAuNS00OS0yMC41VDQzMS0zNjYuODg2cS0yMCAyMC4xMTQtMjAgNDkuNzI4dDE5LjM4NiA0OS4zODZxMTkuMzg2IDE5Ljc3MiA0OSAxOS43NzJaTTQxNi00MzFoMTI4di0yNjVINDE2djI2NVptNjQuMjc2IDM4MXEtODguOTE2IDAtMTY3Ljc0My0zMy4xMDQtNzguODI4LTMzLjEwMy0xMzcuNTc3LTkxLjg1Mi01OC43NDktNTguNzQ5LTkxLjg1Mi0xMzcuNTM1UTUwLTM5MS4yNzcgNTAtNDgwLjQ1OHEwLTg5LjQzOCAzMy4xNjItMTY3LjQ5MSAzMy4xNjMtNzguMDUzIDkyLjE3NS0xMzYuOTQyIDU5LjAxMS01OC44ODkgMTM3LjUzMy05MS45OTlRMzkxLjM5My05MTAgNDgwLjQ1OC05MTBxODkuNDI4IDAgMTY3LjUxOCAzMy4wOTNUNzg0Ljk0LTc4NC45NHE1OC44NzQgNTguODc0IDkxLjk2NyAxMzcuMjE1UTkxMC01NjkuMzg1IDkxMC00ODAuMTkycTAgODkuMTkyLTMzLjExIDE2Ny41MTgtMzMuMTEgNzguMzI2LTkxLjk5OSAxMzcuMzM3LTU4Ljg4OSA1OS4wMTItMTM3LjE2NyA5Mi4xNzRRNTY5LjQ0Ny01MCA0ODAuMjc2LTUwWiIvPjwvc3ZnPg==); +} diff --git a/static/js/copy_button.js b/static/js/copy_button.js new file mode 100644 index 0000000..712f7a4 --- /dev/null +++ b/static/js/copy_button.js @@ -0,0 +1,19 @@ +function changeIcon(copyDiv, className) { + copyDiv.classList.add(className); + setTimeout(() => copyDiv.classList.remove(className), 2500); +} + +document.querySelectorAll("pre").forEach((block) => { + const copyDiv = document.createElement("div"); + copyDiv.className = "copy-code"; + block.prepend(copyDiv); + + copyDiv.addEventListener("click", function () { + const code = block.innerText; + navigator.clipboard.writeText(code).then(() => { + changeIcon(copyDiv, "checked"); + }, () => { + changeIcon(copyDiv, "error"); + }); + }); +}); From 787243c3c5f32735e0476359901b0df79d382c11 Mon Sep 17 00:00:00 2001 From: welpo Date: Thu, 6 Jul 2023 13:55:00 +0200 Subject: [PATCH 03/13] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20unify=20?= =?UTF-8?q?table=20styling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sass/parts/_misc.scss | 29 ----------------------------- sass/parts/_table.scss | 20 ++++++++++++++++---- 2 files changed, 16 insertions(+), 33 deletions(-) diff --git a/sass/parts/_misc.scss b/sass/parts/_misc.scss index 1dc3929..964d19e 100644 --- a/sass/parts/_misc.scss +++ b/sass/parts/_misc.scss @@ -112,35 +112,6 @@ a:not(.no-hover-padding):hover::before { } } -table { - justify-self: center; - font: inherit; - overflow: hidden; - border-style: hidden !important; - margin: 2rem 0; - min-width: 400px; - border: none; - margin-left: auto; - margin-right: auto; - min-width: 13rem; -} - -table thead tr { - background-color: var(--primary-color); - color: var(--hover-color); - text-align: left; -} - -table th, -table td { - padding: 0.5em 0.7em; - font-family: 'Source Serif Pro', serif; -} - -table tbody tr:nth-child(even) { - background-color: var(--bg-0); -} - .footnote-reference { font-family: var(--serif-font); font-size: 0.7rem; diff --git a/sass/parts/_table.scss b/sass/parts/_table.scss index 5422a9b..c805a46 100644 --- a/sass/parts/_table.scss +++ b/sass/parts/_table.scss @@ -1,15 +1,27 @@ table { border-spacing: 0; border-collapse: collapse; + justify-self: center; + font: inherit; + overflow: hidden; + border-style: hidden !important; + margin: 2rem auto; + min-width: 13rem; } -table th { +table th, +table td { padding: 6px 13px; border: 1px solid #dfe2e5; font-size: large; } -table td { - padding: 6px 13px; - border: 1px solid #dfe2e5; +table thead tr { + background-color: var(--primary-color); + color: var(--hover-color); + text-align: left; +} + +table tbody tr:nth-child(even) { + background-color: var(--bg-0); } From 7c3463c0fe1539a56202f1b36da951156a931552 Mon Sep 17 00:00:00 2001 From: welpo Date: Fri, 7 Jul 2023 16:14:12 +0200 Subject: [PATCH 04/13] =?UTF-8?q?=F0=9F=92=84=20style:=20round=20tables=20?= =?UTF-8?q?borders?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sass/parts/_table.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/sass/parts/_table.scss b/sass/parts/_table.scss index c805a46..6a66b3d 100644 --- a/sass/parts/_table.scss +++ b/sass/parts/_table.scss @@ -7,6 +7,7 @@ table { border-style: hidden !important; margin: 2rem auto; min-width: 13rem; + border-radius: 5px; } table th, From fa5e21feeaf40cd57f5145e2ea2273c378bf3306 Mon Sep 17 00:00:00 2001 From: welpo Date: Fri, 7 Jul 2023 18:02:32 +0200 Subject: [PATCH 05/13] =?UTF-8?q?=F0=9F=92=AC=20docs:=20translate=20'Usage?= =?UTF-8?q?'=20header?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- content/blog/shortcodes.ca.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/blog/shortcodes.ca.md b/content/blog/shortcodes.ca.md index a6a3dce..d85a53f 100644 --- a/content/blog/shortcodes.ca.md +++ b/content/blog/shortcodes.ca.md @@ -1,7 +1,7 @@ +++ title = "Shortcodes personalitzats" date = 2023-02-19 -updated = 2023-07-05 +updated = 2023-07-07 description = "Aquest tema inclou alguns shortcodes personalitzats útils que pots utilitzar per millorar les teves publicacions. Ja sigui per mostrar imatges que s'adapten als temes clar i fosc, o per donar format a una secció de referències amb un aspecte professional, aquests shortcodes personalitzats t'ajudaran." [taxonomies] @@ -39,7 +39,7 @@ Les imatges amb massa brillantor o contrast poden ser molestes en un fons fosc. {{ dimmable_image(src="img/desert_by_oskerwyld.webp", alt="Fotografia d'un desert, cel celestial") }} -#### Usage +#### Ús ``` {{/* dimmable_image(src="img/desert_by_oskerwyld.webp", alt="Fotografia d'un desert, cel celestial") */}} From 8415535e1337a00c9b23e524ade3734d94fc0965 Mon Sep 17 00:00:00 2001 From: welpo Date: Fri, 7 Jul 2023 21:53:26 +0200 Subject: [PATCH 06/13] =?UTF-8?q?=F0=9F=92=84=20style:=20add=20codeblock?= =?UTF-8?q?=20background=20colours?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sass/main.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sass/main.scss b/sass/main.scss index e2545fe..4c83db0 100644 --- a/sass/main.scss +++ b/sass/main.scss @@ -65,6 +65,8 @@ --quote-color: #355f62; --border-color: #727272; --meta-color: #5b5b65; + --codeblock-bg: #272430; + --codeblock-highlight: #433e52; --theme-switcher-svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpath d='M283.211 512c78.962 0 151.079-35.925 198.857-94.792 7.068-8.708-.639-21.43-11.562-19.35-124.203 23.654-238.262-71.576-238.262-196.954 0-72.222 38.662-138.635 101.498-174.394 9.686-5.512 7.25-20.197-3.756-22.23A258.156 258.156 0 0 0 283.211 0c-141.309 0-256 114.511-256 256 0 141.309 114.511 256 256 256z'/%3E%3C/svg%3E%0A"); } @@ -83,6 +85,8 @@ --quote-color: #a9c5c7; --border-color: black; --meta-color: #B0B0B0; + --codeblock-bg: #151515; + --codeblock-highlight: #292929; --theme-switcher-svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 96 960 960' %3E%3Cpath d='M480 776q-83 0-141.5-58.5T280 576q0-83 58.5-141.5T480 376q83 0 141.5 58.5T680 576q0 83-58.5 141.5T480 776ZM80 616q-17 0-28.5-11.5T40 576q0-17 11.5-28.5T80 536h80q17 0 28.5 11.5T200 576q0 17-11.5 28.5T160 616H80Zm720 0q-17 0-28.5-11.5T760 576q0-17 11.5-28.5T800 536h80q17 0 28.5 11.5T920 576q0 17-11.5 28.5T880 616h-80ZM480 296q-17 0-28.5-11.5T440 256v-80q0-17 11.5-28.5T480 136q17 0 28.5 11.5T520 176v80q0 17-11.5 28.5T480 296Zm0 720q-17 0-28.5-11.5T440 976v-80q0-17 11.5-28.5T480 856q17 0 28.5 11.5T520 896v80q0 17-11.5 28.5T480 1016ZM226 378l-43-42q-12-11-11.5-28t11.5-29q12-12 29-12t28 12l42 43q11 12 11 28t-11 28q-11 12-27.5 11.5T226 378Zm494 495-42-43q-11-12-11-28.5t11-27.5q11-12 27.5-11.5T734 774l43 42q12 11 11.5 28T777 873q-12 12-29 12t-28-12Zm-42-495q-12-11-11.5-27.5T678 322l42-43q11-12 28-11.5t29 11.5q12 12 12 29t-12 28l-43 42q-12 11-28 11t-28-11ZM183 873q-12-12-12-29t12-28l43-42q12-11 28.5-11t27.5 11q12 11 11.5 27.5T282 830l-42 43q-11 12-28 11.5T183 873Z'/%3E%3C/svg%3E"); From f5603acbdb8968126deb3818af2cef018ed79b75 Mon Sep 17 00:00:00 2001 From: welpo Date: Fri, 7 Jul 2023 21:54:13 +0200 Subject: [PATCH 07/13] =?UTF-8?q?=F0=9F=92=84=20style:=20reduce=20bold=20f?= =?UTF-8?q?ont-weight?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sass/main.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sass/main.scss b/sass/main.scss index 4c83db0..50f069d 100644 --- a/sass/main.scss +++ b/sass/main.scss @@ -219,6 +219,10 @@ p { font-size: 1em; } +strong { + font-weight: 620; +} + .centered-text { text-align: center; } From f710b62631ab2b3cb791bccd624c40b249c57fb0 Mon Sep 17 00:00:00 2001 From: welpo Date: Fri, 7 Jul 2023 21:58:47 +0200 Subject: [PATCH 08/13] =?UTF-8?q?=F0=9F=90=9B=20fix:=20properly=20check=20?= =?UTF-8?q?for=20`theme=5Fswitcher`=20setting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/partials/nav.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/partials/nav.html b/templates/partials/nav.html index d7173a0..10295e7 100644 --- a/templates/partials/nav.html +++ b/templates/partials/nav.html @@ -62,7 +62,7 @@ {%- endif %} {# Theme switcher #} - {%- if config.extra.theme_switcher == true -%} + {%- if config.extra.theme_switcher and config.extra.theme_switcher == true -%}
  • From 2dec139e41ffe558b7d8fdd785ed5f1889d6723b Mon Sep 17 00:00:00 2001 From: welpo Date: Fri, 7 Jul 2023 22:03:47 +0200 Subject: [PATCH 09/13] =?UTF-8?q?=E2=9C=A8=20feat:=20add=20copy=20button?= =?UTF-8?q?=20to=20code=20blocks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.toml | 3 + content/blog/almost-no-js.ca.md | 17 ---- content/blog/almost-no-js.es.md | 17 ---- content/blog/almost-no-js.md | 17 ---- content/blog/javascript.ca.md | 22 ++++++ content/blog/javascript.es.md | 22 ++++++ content/blog/javascript.md | 22 ++++++ sass/parts/_code.scss | 112 ++++++++++++++++++--------- static/js/copyCodeToClipboard.js | 37 +++++++++ static/js/copyCodeToClipboard_min.js | 1 + static/js/copy_button.js | 19 ----- templates/base.html | 11 ++- templates/partials/header.html | 2 +- 13 files changed, 190 insertions(+), 112 deletions(-) delete mode 100644 content/blog/almost-no-js.ca.md delete mode 100644 content/blog/almost-no-js.es.md delete mode 100644 content/blog/almost-no-js.md create mode 100644 content/blog/javascript.ca.md create mode 100644 content/blog/javascript.es.md create mode 100644 content/blog/javascript.md create mode 100644 static/js/copyCodeToClipboard.js create mode 100644 static/js/copyCodeToClipboard_min.js delete mode 100644 static/js/copy_button.js diff --git a/config.toml b/config.toml index 1fff6c5..9827a9d 100644 --- a/config.toml +++ b/config.toml @@ -115,6 +115,9 @@ language_name.es = "Español" # The default setting is the light theme. theme_switcher = true +# Add a "copy" button to codeblocks (loads ~700 bytes of JavaScript). +copy_button = true + # Date format used when listing posts (main page, /blog section, tag posts list…) # Default is "6th July 2049" in English and "%d %B %Y" in other languages. long_date_format = "%d %B %Y" diff --git a/content/blog/almost-no-js.ca.md b/content/blog/almost-no-js.ca.md deleted file mode 100644 index 2e5c759..0000000 --- a/content/blog/almost-no-js.ca.md +++ /dev/null @@ -1,17 +0,0 @@ -+++ -title = "Gairebé sense JavaScript" -date = 2023-01-06 -updated = 2023-04-28 -description = "JavaScript només s'utilitza quan HTML i CSS no són suficients." - -[taxonomies] -tags = ["funcionalitat"] -+++ - -# JavaScript? - -Aquest tema gairebé no utilitza JavaScript. Inclou uns ~900 bytes de fitxers `.js` amb la lògica per al canvi de tema clar/fosc, que es pot desactivar establint `theme_switcher = false` al fitxer `config.toml`. - -La funcionalitat de KaTex, que requereix carregar un fitxer JavaScript de 274 KB, es pot activar per a publicacions específiques. - -A part d'això, és un tema ràpid amb HTML i CSS. Tal i com hauria de ser (la major part de) la web :-) diff --git a/content/blog/almost-no-js.es.md b/content/blog/almost-no-js.es.md deleted file mode 100644 index 3d1c645..0000000 --- a/content/blog/almost-no-js.es.md +++ /dev/null @@ -1,17 +0,0 @@ -+++ -title = "Casi sin JavaScript" -date = 2023-01-06 -updated = 2023-04-28 -description = "JavaScript solo se utiliza cuando HTML y CSS no son suficientes." - -[taxonomies] -tags = ["funcionalidad"] -+++ - -# ¿JavaScript? - -Este tema casi no utiliza JavaScript. Incluye ~900 bytes de código `.js` con la lógica para el interruptor de modo claro/oscuro, el cual puede ser desactivado configurando `theme_switcher = false` en el archivo `config.toml`. - -El soporte de KaTeX, que requiere cargar un archivo JavaScript de 274 KB, puede ser activado para publicaciones específicas. - -Aparte de esto, es un tema rápido con HTML y CSS. Como debería ser (en su mayoría) la web :-) diff --git a/content/blog/almost-no-js.md b/content/blog/almost-no-js.md deleted file mode 100644 index 8e27596..0000000 --- a/content/blog/almost-no-js.md +++ /dev/null @@ -1,17 +0,0 @@ -+++ -title = "Almost no JavaScript" -date = 2023-01-06 -updated = 2023-04-28 -description = "JavaScript is only used when HTML and CSS aren't enough." - -[taxonomies] -tags = ["showcase"] -+++ - -# JavaScript? - -This theme has almost no JavaScript. It includes ~900 bytes of `.js` with the logic for the light/dark mode switch, which can be disabled by setting `theme_switcher = false` in the `config.toml` file. - -KaTex support, which requires loading a 274 KB JavaScript file, can be activated for specific posts. - -Other than that, it's a fast site with HTML and CSS. Just the way (most of) the web should be :-) diff --git a/content/blog/javascript.ca.md b/content/blog/javascript.ca.md new file mode 100644 index 0000000..28eb3a6 --- /dev/null +++ b/content/blog/javascript.ca.md @@ -0,0 +1,22 @@ ++++ +title = "Sense JavaScript obligatori" +date = 2023-01-06 +updated = 2023-04-28 +description = "JavaScript només s'utilitza quan HTML i CSS no són suficients." + +[taxonomies] +tags = ["funcionalitat"] ++++ + +## JavaScript? + +Aquest tema funciona perfectament sense JavaScript. Opcionalment, pot carregar una quantitat mínima per afegir algunes funcionalitats que no són possibles utilitzant només HTML i CSS: + +- **Canvi de mode clar/fosc**. S'activa establint `theme_switcher = true`. (~900 bytes) +- **Còpia de blocs de codi amb un sol clic**. S'activa establint `copy_button = true`. (~700 bytes) + +Aquestes dues configuracions cal aplicar-les a la secció `[extra]` del fitxer `config.toml`. + +La funcionalitat de KaTex, que requereix carregar un fitxer JavaScript de 274 KB, es pot activar per a publicacions específiques. Això es pot fer establint `katex = true` a la secció `[extra]` de l'encapçalament de la publicació. + +A part d'això, és un tema ràpid amb HTML i CSS. Tal i com hauria de ser (la major part de) la web :-) diff --git a/content/blog/javascript.es.md b/content/blog/javascript.es.md new file mode 100644 index 0000000..6966362 --- /dev/null +++ b/content/blog/javascript.es.md @@ -0,0 +1,22 @@ ++++ +title = "Sin JavaScript obligatorio" +date = 2023-01-06 +updated = 2023-04-28 +description = "JavaScript solo se utiliza cuando HTML y CSS no son suficientes." + +[taxonomies] +tags = ["funcionalidad"] ++++ + +## ¿JavaScript? + +Este tema funciona perfectamente sin JavaScript. Opcionalmente, puede cargar una cantidad mínima para añadir algunas funciones que son imposibles de lograr con HTML y CSS: + +- **El cambio de modo claro/oscuro**. Habilitado estableciendo `theme_switcher = true`. (~900 bytes) +- **Copia de bloques de código con un clic**. Se activa configurando `copy_button = true`. (~700 bytes) + +Estas dos configuraciones se deben aplicar en la sección `[extra]` de tu archivo `config.toml`. + +El soporte de KaTex, que requiere cargar un archivo JavaScript de 274 KB, se puede activar para publicaciones específicas. Esto se puede hacer configurando `katex = true` en la sección `[extra]` del encabezado de la publicación. + +Aparte de esto, es un tema rápido con HTML y CSS. Como debería ser (en su mayoría) la web :-) diff --git a/content/blog/javascript.md b/content/blog/javascript.md new file mode 100644 index 0000000..cc8082a --- /dev/null +++ b/content/blog/javascript.md @@ -0,0 +1,22 @@ ++++ +title = "No mandatory JavaScript" +date = 2023-01-06 +updated = 2023-04-28 +description = "JavaScript is only used when HTML and CSS aren't enough." + +[taxonomies] +tags = ["showcase"] ++++ + +## JavaScript? + +This theme has no mandatory JavaScript. Optionally, it can load a minimal amount to add some features that are impossible to achieve with HTML and CSS: + +- **Light/dark mode switch**. Enabled by setting `theme_switcher = true`. (~900 bytes) +- **One-click copy of code blocks**. Enabled by setting `copy_button = true`. (~700 bytes) + +These two settings can be applied in the `[extra]` section of your `config.toml` file. + +KaTex support, which requires loading a 274 KB JavaScript file, can be activated for specific posts. This can be done by setting `katex = true` in the post's `[extra]` section of the post's front matter. + +Other than that, it's a fast site with HTML and CSS. Just the way (most of) the web should be :-) diff --git a/sass/parts/_code.scss b/sass/parts/_code.scss index d68d207..2995cff 100644 --- a/sass/parts/_code.scss +++ b/sass/parts/_code.scss @@ -2,68 +2,104 @@ code { background-color: var(--bg-1); padding: 0.1em 0.2em; font-family: var(--code-font); - font-size: 0.9em; + font-size: 0.9rem; + + mark { + background-color: var(--codeblock-highlight); + color: inherit; + filter: brightness(110%); + display: block; + } + + table { + width: 100%; + margin: 0rem; + border-collapse: collapse; + border-spacing: 0rem; + + td, + th, + tr { + border: none; + padding: 0rem; + } + + tbody td:first-child { + user-select: none; + width: 2rem; + text-align: left; + } + + tbody tr:nth-child(even) { + background-color: inherit; + } + } } pre { + overflow: hidden; + position: relative; display: block; line-height: 1.4; overflow-x: auto; padding: 2rem 1rem 1rem; - position: relative; -webkit-overflow-scrolling: touch; border-radius: 5px; -} -pre code { - background-color: transparent; - color: inherit; - padding: 0; - border: 0; - border-radius: 4px; -} + code { + display: block; + overflow-x: auto; + white-space: pre; + background-color: transparent; + color: inherit; + padding: 0rem; + border: 0rem; + border-radius: 5px; -pre code[class*="language-"] { - -webkit-overflow-scrolling: touch; -} + &::before { + content: attr(data-lang); + display: block; + background-color: var(--primary-color); + color: var(--hover-color); + padding: 0.3rem; + padding-left: 1rem; + width: calc(100% - 1.3rem); + height: 0.9rem; + font-size: 0.65rem; + position: absolute; + text-align: left; + text-transform: uppercase; + top: 0; + left: 0; + } -pre code[class*="language-"]::before { - content: attr(data-lang); - display: block; - background-color: var(--primary-color); - color: var(--hover-color); - padding: 0.3rem; - padding-left: 1rem; - font-family: var(--code-font); - width: 100%; - font-size: 0.65rem; - width: 100%; - position: absolute; - text-align: left; - text-transform: uppercase; - top: 0; - left: 0; + &[class*="language-"] { + -webkit-overflow-scrolling: touch; + } + } } .copy-code { z-index: 1; - -webkit-mask: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Ik0yMTcuMDAyLTY3LjY5NHEtMzcuNzMyIDAtNjQuMDItMjYuMjg4LTI2LjI4Ny0yNi4yODctMjYuMjg3LTY0LjAxOVYtNzA3LjY5aDc3Ljk5OXY1NDkuNjg5cTAgNC42MTUgMy44NDYgOC40NjIgMy44NDYgMy44NDYgOC40NjIgMy44NDZoNDUxLjY4OXY3Ny45OTlIMjE3LjAwMlptMTc1Ljk5OS0xNzUuOTk5cS0zNy43MzMgMC02NC4wMi0yNi4yODdUMzAyLjY5NC0zMzR2LTQ2My4zODNxMC0zNy43MzIgMjYuMjg3LTY0LjAyIDI2LjI4Ny0yNi4yODcgNjQuMDItMjYuMjg3aDM2NS4zODNxMzcuNzMyIDAgNjQuMDE5IDI2LjI4NyAyNi4yODggMjYuMjg4IDI2LjI4OCA2NC4wMlYtMzM0cTAgMzcuNzMzLTI2LjI4OCA2NC4wMi0yNi4yODcgMjYuMjg3LTY0LjAxOSAyNi4yODdIMzkzLjAwMVptMC03Ny45OThoMzY1LjM4M3E0LjYxNSAwIDguNDYyLTMuODQ3IDMuODQ2LTMuODQ2IDMuODQ2LTguNDYydi00NjMuMzgzcTAtNC42MTYtMy44NDYtOC40NjItMy44NDctMy44NDYtOC40NjItMy44NDZIMzkzLjAwMXEtNC42MTYgMC04LjQ2MiAzLjg0Ni0zLjg0NyAzLjg0Ni0zLjg0NyA4LjQ2MlYtMzM0cTAgNC42MTYgMy44NDcgOC40NjIgMy44NDYgMy44NDcgOC40NjIgMy44NDdabS0xMi4zMDkgMHYtNDg4Vi0zMjEuNjkxWiIvPjwvc3ZnPg==); - // -webkit-mask: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Ik0yMjIuNzgzLTEyNC43ODJxLTQwLjQyNiAwLTY5LjIxMy0yOC43ODgtMjguNzg4LTI4Ljc4Ny0yOC43ODgtNjkuMjEzdi01MTQuNDM0cTAtNDAuNDI2IDI4Ljc4OC02OS4yMTMgMjguNzg3LTI4Ljc4OCA2OS4yMTMtMjguNzg4aDE0OS41MjFxMTEuMzkxLTMyLjY5NiA0MC40MzgtNTMuNzYxIDI5LjA0Ni0yMS4wNjYgNjcuMjU4LTIxLjA2NiAzNi44MjYgMCA2Ni4yODMgMjEuMDY2IDI5LjQ1NyAyMS4wNjUgNDEuNDEzIDUzLjc2MWgxNDkuNTIxcTQwLjQyNiAwIDY5LjIxMyAyOC43ODggMjguNzg4IDI4Ljc4NyAyOC43ODggNjkuMjEzdjUxNC40MzRxMCA0MC40MjYtMjguNzg4IDY5LjIxMy0yOC43ODcgMjguNzg4LTY5LjIxMyAyOC43ODhIMjIyLjc4M1ptMC05OC4wMDFoNTE0LjQzNHYtNTE0LjQzNGgtNjguMDQzdjEyOS4wNDRIMjkwLjgyNnYtMTI5LjA0NGgtNjguMDQzdjUxNC40MzRabTI1Ny4wMDYtNTIyLjkxM3ExNS4yMTEgMCAyNS43MTEtMTAuMjg5IDEwLjUtMTAuMjkgMTAuNS0yNS41IDAtMTUuMjExLTEwLjI4OS0yNS43MTEtMTAuMjktMTAuNS0yNS41LTEwLjUtMTUuMjExIDAtMjUuNzExIDEwLjI5LTEwLjUgMTAuMjg5LTEwLjUgMjUuNSAwIDE1LjIxIDEwLjI4OSAyNS43MSAxMC4yOSAxMC41IDI1LjUgMTAuNVoiLz48L3N2Zz4); + -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960' %3E%3Cpath d='M217.002-67.694q-37.732 0-64.02-26.288-26.287-26.287-26.287-64.019V-707.69h77.999v549.689q0 4.615 3.846 8.462 3.846 3.846 8.462 3.846h451.689v77.999H217.002Zm175.999-175.999q-37.733 0-64.02-26.287T302.694-334v-463.383q0-37.732 26.287-64.02 26.287-26.287 64.02-26.287h365.383q37.732 0 64.019 26.287 26.288 26.288 26.288 64.02V-334q0 37.733-26.288 64.02-26.287 26.287-64.019 26.287H393.001Zm0-77.998h365.383q4.615 0 8.462-3.847 3.846-3.846 3.846-8.462v-463.383q0-4.616-3.846-8.462-3.847-3.846-8.462-3.846H393.001q-4.616 0-8.462 3.846-3.847 3.846-3.847 8.462V-334q0 4.616 3.847 8.462 3.846 3.847 8.462 3.847Zm-12.309 0v-488V-321.691Z'/%3E%3C/svg%3E"); background: var(--hover-color); cursor: pointer; - display: inline-block; position: absolute; - height: 20px; - width: 20px; + height: 0.9rem; + width: 0.9rem; + background-size: contain; color: white; - right: 0.5rem; - top: 0.2rem; + right: 0.7rem; + top: 0.3rem; + align-self: center; } .copy-code.checked { - -webkit-mask: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Ik0zOTUtMjUzIDE5NC00NTVsODMtODMgMTE4IDExNyAyODgtMjg3IDgzIDg0LTM3MSAzNzFaIi8+PC9zdmc+); + -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960' %3E%3Cpath d='M395-253 194-455l83-83 118 117 288-287 83 84-371 371Z'/%3E%3C/svg%3E"); + height: 1rem; + width: 1rem; } .copy-code.error { - -webkit-mask: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Ik00NzkuMzg2LTI0OFE1MDktMjQ4IDUyOS0yNjcuMzg2cTIwLTE5LjM4NiAyMC00OVQ1MjkuNjE0LTM2Ni41cS0xOS4zODYtMjAuNS00OS0yMC41VDQzMS0zNjYuODg2cS0yMCAyMC4xMTQtMjAgNDkuNzI4dDE5LjM4NiA0OS4zODZxMTkuMzg2IDE5Ljc3MiA0OSAxOS43NzJaTTQxNi00MzFoMTI4di0yNjVINDE2djI2NVptNjQuMjc2IDM4MXEtODguOTE2IDAtMTY3Ljc0My0zMy4xMDQtNzguODI4LTMzLjEwMy0xMzcuNTc3LTkxLjg1Mi01OC43NDktNTguNzQ5LTkxLjg1Mi0xMzcuNTM1UTUwLTM5MS4yNzcgNTAtNDgwLjQ1OHEwLTg5LjQzOCAzMy4xNjItMTY3LjQ5MSAzMy4xNjMtNzguMDUzIDkyLjE3NS0xMzYuOTQyIDU5LjAxMS01OC44ODkgMTM3LjUzMy05MS45OTlRMzkxLjM5My05MTAgNDgwLjQ1OC05MTBxODkuNDI4IDAgMTY3LjUxOCAzMy4wOTNUNzg0Ljk0LTc4NC45NHE1OC44NzQgNTguODc0IDkxLjk2NyAxMzcuMjE1UTkxMC01NjkuMzg1IDkxMC00ODAuMTkycTAgODkuMTkyLTMzLjExIDE2Ny41MTgtMzMuMTEgNzguMzI2LTkxLjk5OSAxMzcuMzM3LTU4Ljg4OSA1OS4wMTItMTM3LjE2NyA5Mi4xNzRRNTY5LjQ0Ny01MCA0ODAuMjc2LTUwWiIvPjwvc3ZnPg==); + -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960' %3E%3Cpath d='M479.386-248Q509-248 529-267.386q20-19.386 20-49T529.614-366.5q-19.386-20.5-49-20.5T431-366.886q-20 20.114-20 49.728t19.386 49.386q19.386 19.772 49 19.772ZM416-431h128v-265H416v265Zm64.276 381q-88.916 0-167.743-33.104-78.828-33.103-137.577-91.852-58.749-58.749-91.852-137.535Q50-391.277 50-480.458q0-89.438 33.162-167.491 33.163-78.053 92.175-136.942 59.011-58.889 137.533-91.999Q391.393-910 480.458-910q89.428 0 167.518 33.093T784.94-784.94q58.874 58.874 91.967 137.215Q910-569.385 910-480.192q0 89.192-33.11 167.518-33.11 78.326-91.999 137.337-58.889 59.012-137.167 92.174Q569.447-50 480.276-50Z'/%3E%3C/svg%3E"); } diff --git a/static/js/copyCodeToClipboard.js b/static/js/copyCodeToClipboard.js new file mode 100644 index 0000000..ba98ba3 --- /dev/null +++ b/static/js/copyCodeToClipboard.js @@ -0,0 +1,37 @@ +const changeIcon = (copyDiv, className) => { + copyDiv.classList.add(className); + setTimeout(() => copyDiv.classList.remove(className), 2500); +}; + +const addCopyEventListenerToDiv = (copyDiv, block) => { + copyDiv.addEventListener("click", () => copyCodeAndChangeIcon(copyDiv, block)); +}; + +const copyCodeAndChangeIcon = async (copyDiv, block) => { + const code = block.querySelector('table') ? getTableCode(block) : getNonTableCode(block); + try { + await navigator.clipboard.writeText(code); + changeIcon(copyDiv, "checked"); + } catch (error) { + changeIcon(copyDiv, "error"); + } +}; + +const getNonTableCode = (block) => { + return [...block.querySelectorAll('code')] + .map(code => code.textContent) + .join(''); +}; + +const getTableCode = (block) => { + return [...block.querySelectorAll('tr')] + .map(row => row.querySelector('td:last-child')?.innerText ?? '') + .join(''); +}; + +document.querySelectorAll("pre").forEach((block) => { + const copyDiv = document.createElement("div"); + copyDiv.className = "copy-code"; + block.prepend(copyDiv); + addCopyEventListenerToDiv(copyDiv, block); +}); diff --git a/static/js/copyCodeToClipboard_min.js b/static/js/copyCodeToClipboard_min.js new file mode 100644 index 0000000..9d144b1 --- /dev/null +++ b/static/js/copyCodeToClipboard_min.js @@ -0,0 +1 @@ +const changeIcon=(e,t)=>{e.classList.add(t),setTimeout(()=>e.classList.remove(t),2500)},addCopyEventListenerToDiv=(e,t)=>{e.addEventListener("click",()=>copyCodeAndChangeIcon(e,t))},copyCodeAndChangeIcon=async(e,t)=>{let o=t.querySelector("table")?getTableCode(t):getNonTableCode(t);try{await navigator.clipboard.writeText(o),changeIcon(e,"checked")}catch(c){changeIcon(e,"error")}},getNonTableCode=e=>[...e.querySelectorAll("code")].map(e=>e.textContent).join(""),getTableCode=e=>[...e.querySelectorAll("tr")].map(e=>e.querySelector("td:last-child")?.innerText??"").join("");document.querySelectorAll("pre").forEach(e=>{let t=document.createElement("div");t.className="copy-code",e.prepend(t),addCopyEventListenerToDiv(t,e)}); diff --git a/static/js/copy_button.js b/static/js/copy_button.js deleted file mode 100644 index 712f7a4..0000000 --- a/static/js/copy_button.js +++ /dev/null @@ -1,19 +0,0 @@ -function changeIcon(copyDiv, className) { - copyDiv.classList.add(className); - setTimeout(() => copyDiv.classList.remove(className), 2500); -} - -document.querySelectorAll("pre").forEach((block) => { - const copyDiv = document.createElement("div"); - copyDiv.className = "copy-code"; - block.prepend(copyDiv); - - copyDiv.addEventListener("click", function () { - const code = block.innerText; - navigator.clipboard.writeText(code).then(() => { - changeIcon(copyDiv, "checked"); - }, () => { - changeIcon(copyDiv, "error"); - }); - }); -}); diff --git a/templates/base.html b/templates/base.html index 1e37aac..cd09f2f 100644 --- a/templates/base.html +++ b/templates/base.html @@ -22,11 +22,16 @@ {% include "partials/footer.html" %} - {% if page.extra.katex and page.extra.katex == true %} + {# Add KaTeX functionality (loads CSS and JS) #} + {%- if page.extra.katex and page.extra.katex == true -%} - - {% endif %} + {%- endif -%} + + {# Add copy button to codeblocks #} + {%- if config.extra.copy_button and config.extra.copy_button == true -%} + + {%- endif -%} diff --git a/templates/partials/header.html b/templates/partials/header.html index dbb47a9..5d82c09 100644 --- a/templates/partials/header.html +++ b/templates/partials/header.html @@ -69,7 +69,7 @@ {%- endfor -%} {%- endif -%}"> - {%- if config.extra.theme_switcher == true -%} + {%- if config.extra.theme_switcher and config.extra.theme_switcher == true -%} {%- endif -%} From 139ca042f41f8ca96b105ba8e03da56400486895 Mon Sep 17 00:00:00 2001 From: welpo Date: Fri, 7 Jul 2023 22:12:50 +0200 Subject: [PATCH 10/13] =?UTF-8?q?=F0=9F=93=9D=20docs:=20set=20proper=20`up?= =?UTF-8?q?dated`=20date?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- content/blog/javascript.ca.md | 2 +- content/blog/javascript.es.md | 2 +- content/blog/javascript.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/content/blog/javascript.ca.md b/content/blog/javascript.ca.md index 28eb3a6..9c54e63 100644 --- a/content/blog/javascript.ca.md +++ b/content/blog/javascript.ca.md @@ -1,7 +1,7 @@ +++ title = "Sense JavaScript obligatori" date = 2023-01-06 -updated = 2023-04-28 +updated = 2023-07-07 description = "JavaScript només s'utilitza quan HTML i CSS no són suficients." [taxonomies] diff --git a/content/blog/javascript.es.md b/content/blog/javascript.es.md index 6966362..212b1f5 100644 --- a/content/blog/javascript.es.md +++ b/content/blog/javascript.es.md @@ -1,7 +1,7 @@ +++ title = "Sin JavaScript obligatorio" date = 2023-01-06 -updated = 2023-04-28 +updated = 2023-07-07 description = "JavaScript solo se utiliza cuando HTML y CSS no son suficientes." [taxonomies] diff --git a/content/blog/javascript.md b/content/blog/javascript.md index cc8082a..ca7476a 100644 --- a/content/blog/javascript.md +++ b/content/blog/javascript.md @@ -1,7 +1,7 @@ +++ title = "No mandatory JavaScript" date = 2023-01-06 -updated = 2023-04-28 +updated = 2023-07-07 description = "JavaScript is only used when HTML and CSS aren't enough." [taxonomies] From fcc2cafcdcfd5eb14df2208829c33404feb9ae7a Mon Sep 17 00:00:00 2001 From: welpo Date: Sat, 8 Jul 2023 00:51:35 +0200 Subject: [PATCH 11/13] =?UTF-8?q?=F0=9F=92=84=20style:=20darken=20codebloc?= =?UTF-8?q?k=20highlight=20colour?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sass/main.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sass/main.scss b/sass/main.scss index 50f069d..0dc1043 100644 --- a/sass/main.scss +++ b/sass/main.scss @@ -66,7 +66,7 @@ --border-color: #727272; --meta-color: #5b5b65; --codeblock-bg: #272430; - --codeblock-highlight: #433e52; + --codeblock-highlight: #3d3949; --theme-switcher-svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpath d='M283.211 512c78.962 0 151.079-35.925 198.857-94.792 7.068-8.708-.639-21.43-11.562-19.35-124.203 23.654-238.262-71.576-238.262-196.954 0-72.222 38.662-138.635 101.498-174.394 9.686-5.512 7.25-20.197-3.756-22.23A258.156 258.156 0 0 0 283.211 0c-141.309 0-256 114.511-256 256 0 141.309 114.511 256 256 256z'/%3E%3C/svg%3E%0A"); } From 1cd34b528efe8a8a1e0ad6ef1ee92d804aee75a9 Mon Sep 17 00:00:00 2001 From: welpo Date: Sat, 8 Jul 2023 00:56:32 +0200 Subject: [PATCH 12/13] =?UTF-8?q?=F0=9F=93=9D=20docs:=20improve=20KaTeX=20?= =?UTF-8?q?documentation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- content/blog/javascript.ca.md | 4 ++-- content/blog/javascript.es.md | 4 ++-- content/blog/javascript.md | 4 ++-- content/blog/markdown.ca.md | 17 +++++++++++++++-- content/blog/markdown.es.md | 17 +++++++++++++++-- content/blog/markdown.md | 17 +++++++++++++++-- 6 files changed, 51 insertions(+), 12 deletions(-) diff --git a/content/blog/javascript.ca.md b/content/blog/javascript.ca.md index 9c54e63..a6c98a7 100644 --- a/content/blog/javascript.ca.md +++ b/content/blog/javascript.ca.md @@ -1,7 +1,7 @@ +++ title = "Sense JavaScript obligatori" date = 2023-01-06 -updated = 2023-07-07 +updated = 2023-07-08 description = "JavaScript només s'utilitza quan HTML i CSS no són suficients." [taxonomies] @@ -17,6 +17,6 @@ Aquest tema funciona perfectament sense JavaScript. Opcionalment, pot carregar u Aquestes dues configuracions cal aplicar-les a la secció `[extra]` del fitxer `config.toml`. -La funcionalitat de KaTex, que requereix carregar un fitxer JavaScript de 274 KB, es pot activar per a publicacions específiques. Això es pot fer establint `katex = true` a la secció `[extra]` de l'encapçalament de la publicació. +La [funcionalitat de KaTeX](@/blog/markdown.ca.md#katex), que requereix carregar un fitxer JavaScript de 274 KB, es pot activar per a publicacions específiques. Això es pot fer establint `katex = true` a la secció `[extra]` de l'encapçalament de la publicació. A part d'això, és un tema ràpid amb HTML i CSS. Tal i com hauria de ser (la major part de) la web :-) diff --git a/content/blog/javascript.es.md b/content/blog/javascript.es.md index 212b1f5..1dad104 100644 --- a/content/blog/javascript.es.md +++ b/content/blog/javascript.es.md @@ -1,7 +1,7 @@ +++ title = "Sin JavaScript obligatorio" date = 2023-01-06 -updated = 2023-07-07 +updated = 2023-07-08 description = "JavaScript solo se utiliza cuando HTML y CSS no son suficientes." [taxonomies] @@ -17,6 +17,6 @@ Este tema funciona perfectamente sin JavaScript. Opcionalmente, puede cargar una Estas dos configuraciones se deben aplicar en la sección `[extra]` de tu archivo `config.toml`. -El soporte de KaTex, que requiere cargar un archivo JavaScript de 274 KB, se puede activar para publicaciones específicas. Esto se puede hacer configurando `katex = true` en la sección `[extra]` del encabezado de la publicación. +La [funcionalidad de KaTeX](@/blog/markdown.es.md#katex), que requiere cargar un archivo JavaScript de 274 KB, se puede activar para publicaciones específicas. Esto se puede hacer configurando `katex = true` en la sección `[extra]` del encabezado de la publicación. Aparte de esto, es un tema rápido con HTML y CSS. Como debería ser (en su mayoría) la web :-) diff --git a/content/blog/javascript.md b/content/blog/javascript.md index ca7476a..3f792cf 100644 --- a/content/blog/javascript.md +++ b/content/blog/javascript.md @@ -1,7 +1,7 @@ +++ title = "No mandatory JavaScript" date = 2023-01-06 -updated = 2023-07-07 +updated = 2023-07-08 description = "JavaScript is only used when HTML and CSS aren't enough." [taxonomies] @@ -17,6 +17,6 @@ This theme has no mandatory JavaScript. Optionally, it can load a minimal amount These two settings can be applied in the `[extra]` section of your `config.toml` file. -KaTex support, which requires loading a 274 KB JavaScript file, can be activated for specific posts. This can be done by setting `katex = true` in the post's `[extra]` section of the post's front matter. +[KaTeX support](@/blog/markdown.md#katex), which requires loading a 274 KB JavaScript file, can be activated for specific posts. This can be done by setting `katex = true` in the post's `[extra]` section of the post's front matter. Other than that, it's a fast site with HTML and CSS. Just the way (most of) the web should be :-) diff --git a/content/blog/markdown.ca.md b/content/blog/markdown.ca.md index 64e16cb..17aad1d 100644 --- a/content/blog/markdown.ca.md +++ b/content/blog/markdown.ca.md @@ -1,7 +1,7 @@ +++ title = "Exemples de Markdown" date = 2023-01-31 -updated = 2023-06-05 +updated = 2023-07-08 description = "Aquesta publicació mostra alguns exemples de format en Markdown, incloent-hi una taula, blocs de codi i etiquetes, citacions, taules i notes a peu de pàgina." [taxonomies] @@ -23,7 +23,20 @@ Per mostrar l'expressió **en una línia pròpia i centrada**, embolcalla-la amb Per exemple, `\\[ r = \frac{\sum_{i=1}^{n}(x_i - \bar{x})(y_i - \bar{y})}{\sqrt{\sum_{i=1}^{n}(x_i - \bar{x})^2}\sqrt{\sum_{i=1}^{n}(y_i - \bar{y})^2}} \\]` es renderitzarà com: \\[ r = \frac{\sum_{i=1}^{n}(x_i - \bar{x})(y_i - \bar{y})}{\sqrt{\sum_{i=1}^{n}(x_i - \bar{x})^2}\sqrt{\sum_{i=1}^{n}(y_i - \bar{y})^2}} \\] -Per activar $\KaTeX$ en una publicació, inclou `katex = true` dins de la secció `[extra]` dels metadades de la publicació. Per obtenir un millor rendiment i seguretat, els fitxers JavaScript, CSS i les tipografies s'allotgen localment. +Per activar $\KaTeX$ en una publicació, inclou `katex = true` dins de la secció `[extra]` dels metadades de la publicació. Per exemple: + +```toml,hl_lines=5-6 ++++ +title = "Provant KaTeX" +date = 2002-11-30 +updated = 2023-07-08 + +[extra] +katex = true ++++ +``` + +Per obtenir un millor rendiment i seguretat, els fitxers JavaScript, CSS i les tipografies de $\KaTeX$ s'allotgen localment. **Nota**: Després d'activar $\KaTeX$, si vols utilitzar el caràcter \$ sense renderitzar-lo com a expressió matemàtica, escapa'l amb una barra inversa: `\$`. diff --git a/content/blog/markdown.es.md b/content/blog/markdown.es.md index 1d34f43..93a058a 100644 --- a/content/blog/markdown.es.md +++ b/content/blog/markdown.es.md @@ -1,7 +1,7 @@ +++ title = "Ejemplos de Markdown" date = 2023-01-31 -updated = 2023-06-05 +updated = 2023-07-08 description = "Esta publicación muestra algunos ejemplos de formato Markdown, incluyendo una tabla, bloques de código y etiquetas, citas, tablas y notas al pie de página." [taxonomies] @@ -23,7 +23,20 @@ Para mostrar la expresión **en su propia línea y centrada**, envuélvela entre Por ejemplo, `\\[ r = \frac{\sum_{i=1}^{n}(x_i - \bar{x})(y_i - \bar{y})}{\sqrt{\sum_{i=1}^{n}(x_i - \bar{x})^2}\sqrt{\sum_{i=1}^{n}(y_i - \bar{y})^2}} \\]` se mostraría como: \\[ r = \frac{\sum_{i=1}^{n}(x_i - \bar{x})(y_i - \bar{y})}{\sqrt{\sum_{i=1}^{n}(x_i - \bar{x})^2}\sqrt{\sum_{i=1}^{n}(y_i - \bar{y})^2}} \\] -Para activar $\KaTeX$ en una publicación, incluye `katex = true` dentro de la sección `[extra]` del encabezado de la publicación. Para un mejor rendimiento y seguridad, el JavaScript, CSS y las fuentes se alojan localmente. +Para activar $\KaTeX$ en una publicación, incluye `katex = true` dentro de la sección `[extra]` del encabezado de la publicación. Por ejemplo: + +```toml,hl_lines=5-6 ++++ +title = "Probando KaTeX" +date = 2002-11-30 +updated = 2023-07-08 + +[extra] +katex = true ++++ +``` + +Para un mejor rendimiento y seguridad, el JavaScript, CSS y las fuentes de $\KaTeX$ se alojan localmente. **Nota**: Después de habilitar $\KaTeX$, si deseas usar \$ sin representar una expresión matemática, escápalo con una sola barra invertida: `\$`. diff --git a/content/blog/markdown.md b/content/blog/markdown.md index cadbe7f..1efeb3a 100644 --- a/content/blog/markdown.md +++ b/content/blog/markdown.md @@ -1,7 +1,7 @@ +++ title = "Markdown examples" date = 2023-01-31 -updated = 2023-06-05 +updated = 2023-07-08 description = "This post showcases some examples of Markdown formatting, including a table, code blocks and tags, quotes, tables, and footnotes." [taxonomies] @@ -23,7 +23,20 @@ To display the expression **on its own line and centered**, wrap it around `$$` For example, `\\[ r = \frac{\sum_{i=1}^{n}(x_i - \bar{x})(y_i - \bar{y})}{\sqrt{\sum_{i=1}^{n}(x_i - \bar{x})^2}\sqrt{\sum_{i=1}^{n}(y_i - \bar{y})^2}} \\]` renders: \\[ r = \frac{\sum_{i=1}^{n}(x_i - \bar{x})(y_i - \bar{y})}{\sqrt{\sum_{i=1}^{n}(x_i - \bar{x})^2}\sqrt{\sum_{i=1}^{n}(y_i - \bar{y})^2}} \\] -To activate $\KaTeX$ for a post, include `katex = true` within the `[extra]` section of the post's front matter. For enhanced performance and security, the JavaScript, CSS, and fonts are hosted locally. +To activate $\KaTeX$ for a post, include `katex = true` within the `[extra]` section of the post's front matter. For exemple: + +```toml,hl_lines=5-6 ++++ +title = "Testing KaTeX" +date = 2002-11-30 +updated = 2023-07-08 + +[extra] +katex = true ++++ +``` + +For enhanced performance and security, the $\KaTeX$ JavaScript, CSS, and fonts are hosted locally. **Note**: After enabling $\KaTeX$, if you want to use \$ without rendering a mathematical expression, escape it with a single backslash: `\$`. From dcbb4c52907c5fff30ab97841a871d8e3bbbd426 Mon Sep 17 00:00:00 2001 From: welpo Date: Sat, 8 Jul 2023 00:59:05 +0200 Subject: [PATCH 13/13] =?UTF-8?q?=F0=9F=93=9D=20docs:=20remove=20`updated`?= =?UTF-8?q?=20date=20from=20example?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- content/blog/markdown.ca.md | 1 - content/blog/markdown.es.md | 1 - content/blog/markdown.md | 1 - 3 files changed, 3 deletions(-) diff --git a/content/blog/markdown.ca.md b/content/blog/markdown.ca.md index 17aad1d..0242c04 100644 --- a/content/blog/markdown.ca.md +++ b/content/blog/markdown.ca.md @@ -29,7 +29,6 @@ Per activar $\KaTeX$ en una publicació, inclou `katex = true` dins de la secci +++ title = "Provant KaTeX" date = 2002-11-30 -updated = 2023-07-08 [extra] katex = true diff --git a/content/blog/markdown.es.md b/content/blog/markdown.es.md index 93a058a..a1edd58 100644 --- a/content/blog/markdown.es.md +++ b/content/blog/markdown.es.md @@ -29,7 +29,6 @@ Para activar $\KaTeX$ en una publicación, incluye `katex = true` dentro de la s +++ title = "Probando KaTeX" date = 2002-11-30 -updated = 2023-07-08 [extra] katex = true diff --git a/content/blog/markdown.md b/content/blog/markdown.md index 1efeb3a..9aaac68 100644 --- a/content/blog/markdown.md +++ b/content/blog/markdown.md @@ -29,7 +29,6 @@ To activate $\KaTeX$ for a post, include `katex = true` within the `[extra]` sec +++ title = "Testing KaTeX" date = 2002-11-30 -updated = 2023-07-08 [extra] katex = true