syntax highlighting

This commit is contained in:
mehbark 2026-02-18 15:23:53 -05:00
parent 1b5bb837ea
commit 7b57e92622
Signed by: mbk
GPG key ID: E333EC1335FFCCDB
8 changed files with 529 additions and 9 deletions

View file

@ -4,6 +4,7 @@ import { renderToStaticMarkup } from "react-dom/server";
import * as runtime from "react/jsx-runtime";
import { feedPlugin } from "@11ty/eleventy-plugin-rss";
import { IdAttributePlugin } from "@11ty/eleventy";
import rehypePrism from "rehype-prism-plus";
export default function (eleventyConfig) {
eleventyConfig.setInputDirectory("site-src");
@ -15,6 +16,7 @@ export default function (eleventyConfig) {
const { default: mdxContent } = await evaluate(str, {
...runtime,
baseUrl: pathToFileURL(inputPath),
rehypePlugins: [rehypePrism],
});
return async function (data) {

188
package-lock.json generated
View file

@ -13,7 +13,8 @@
"@11ty/eleventy-plugin-rss": "^2.0.4",
"@mdx-js/mdx": "^3.1.1",
"react": "^19.2.3",
"react-dom": "^19.2.3"
"react-dom": "^19.2.3",
"rehype-prism-plus": "^2.0.2"
}
},
"node_modules/@11ty/dependency-tree": {
@ -330,6 +331,12 @@
"integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==",
"license": "MIT"
},
"node_modules/@types/prismjs": {
"version": "1.26.6",
"resolved": "https://registry.npmjs.org/@types/prismjs/-/prismjs-1.26.6.tgz",
"integrity": "sha512-vqlvI7qlMvcCBbVe0AKAb4f97//Hy0EBTaiW8AalRnG/xAN5zOiWWyrNqNXeq8+KAuvRewjCVY1+IPxk4RdNYw==",
"license": "MIT"
},
"node_modules/@types/unist": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz",
@ -1179,6 +1186,57 @@
"js-yaml": "bin/js-yaml.js"
}
},
"node_modules/hast-util-from-html": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/hast-util-from-html/-/hast-util-from-html-2.0.3.tgz",
"integrity": "sha512-CUSRHXyKjzHov8yKsQjGOElXy/3EKpyX56ELnkHH34vDVw1N1XSQ1ZcAvTyAPtGqLTuKP/uxM+aLkSPqF/EtMw==",
"license": "MIT",
"dependencies": {
"@types/hast": "^3.0.0",
"devlop": "^1.1.0",
"hast-util-from-parse5": "^8.0.0",
"parse5": "^7.0.0",
"vfile": "^6.0.0",
"vfile-message": "^4.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/hast-util-from-parse5": {
"version": "8.0.3",
"resolved": "https://registry.npmjs.org/hast-util-from-parse5/-/hast-util-from-parse5-8.0.3.tgz",
"integrity": "sha512-3kxEVkEKt0zvcZ3hCRYI8rqrgwtlIOFMWkbclACvjlDw8Li9S2hk/d51OI0nr/gIpdMHNepwgOKqZ/sy0Clpyg==",
"license": "MIT",
"dependencies": {
"@types/hast": "^3.0.0",
"@types/unist": "^3.0.0",
"devlop": "^1.0.0",
"hastscript": "^9.0.0",
"property-information": "^7.0.0",
"vfile": "^6.0.0",
"vfile-location": "^5.0.0",
"web-namespaces": "^2.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/hast-util-parse-selector": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-4.0.0.tgz",
"integrity": "sha512-wkQCkSYoOGCRKERFWcxMVMOcYE2K1AaNLU8DXS9arxnLOUEWbOXKXiJUNzEpqZ3JOKpnha3jkFrumEjVliDe7A==",
"license": "MIT",
"dependencies": {
"@types/hast": "^3.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/hast-util-to-estree": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/hast-util-to-estree/-/hast-util-to-estree-3.1.3.tgz",
@ -1234,6 +1292,19 @@
"url": "https://opencollective.com/unified"
}
},
"node_modules/hast-util-to-string": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/hast-util-to-string/-/hast-util-to-string-3.0.1.tgz",
"integrity": "sha512-XelQVTDWvqcl3axRfI0xSeoVKzyIFPwsAGSLIsKdJKQMXDYJS4WYrBNF/8J7RdhIcFI2BOHgAifggsvsxp/3+A==",
"license": "MIT",
"dependencies": {
"@types/hast": "^3.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/hast-util-whitespace": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz",
@ -1247,6 +1318,23 @@
"url": "https://opencollective.com/unified"
}
},
"node_modules/hastscript": {
"version": "9.0.1",
"resolved": "https://registry.npmjs.org/hastscript/-/hastscript-9.0.1.tgz",
"integrity": "sha512-g7df9rMFX/SPi34tyGCyUBREQoKkapwdY/T04Qn9TDWfHhAYt4/I0gMVirzK5wEzeUqIjEB+LXC/ypb7Aqno5w==",
"license": "MIT",
"dependencies": {
"@types/hast": "^3.0.0",
"comma-separated-tokens": "^2.0.0",
"hast-util-parse-selector": "^4.0.0",
"property-information": "^7.0.0",
"space-separated-tokens": "^2.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/htmlparser2": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-7.2.0.tgz",
@ -2538,12 +2626,30 @@
"integrity": "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==",
"license": "MIT"
},
"node_modules/parse-numeric-range": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/parse-numeric-range/-/parse-numeric-range-1.3.0.tgz",
"integrity": "sha512-twN+njEipszzlMJd4ONUYgSfZPDxgHhT9Ahed5uTigpQn90FggW4SA/AIPq/6a149fTbE9qBEcSwE3FAEp6wQQ==",
"license": "ISC"
},
"node_modules/parse-srcset": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/parse-srcset/-/parse-srcset-1.0.2.tgz",
"integrity": "sha512-/2qh0lav6CmI15FzA3i/2Bzk2zCgQhGMkvhOhKNcBVQ1ldgpbfiNTVslmooUmWJcADi1f1kIeynbDRVzNlfR6Q==",
"license": "MIT"
},
"node_modules/parse5": {
"version": "7.3.0",
"resolved": "https://registry.npmjs.org/parse5/-/parse5-7.3.0.tgz",
"integrity": "sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==",
"license": "MIT",
"dependencies": {
"entities": "^6.0.0"
},
"funding": {
"url": "https://github.com/inikulin/parse5?sponsor=1"
}
},
"node_modules/parseurl": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
@ -2769,6 +2875,51 @@
"url": "https://opencollective.com/unified"
}
},
"node_modules/refractor": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/refractor/-/refractor-5.0.0.tgz",
"integrity": "sha512-QXOrHQF5jOpjjLfiNk5GFnWhRXvxjUVnlFxkeDmewR5sXkr3iM46Zo+CnRR8B+MDVqkULW4EcLVcRBNOPXHosw==",
"license": "MIT",
"dependencies": {
"@types/hast": "^3.0.0",
"@types/prismjs": "^1.0.0",
"hastscript": "^9.0.0",
"parse-entities": "^4.0.0"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
}
},
"node_modules/rehype-parse": {
"version": "9.0.1",
"resolved": "https://registry.npmjs.org/rehype-parse/-/rehype-parse-9.0.1.tgz",
"integrity": "sha512-ksCzCD0Fgfh7trPDxr2rSylbwq9iYDkSn8TCDmEJ49ljEUBxDVCzCHv7QNzZOfODanX4+bWQ4WZqLCRWYLfhag==",
"license": "MIT",
"dependencies": {
"@types/hast": "^3.0.0",
"hast-util-from-html": "^2.0.0",
"unified": "^11.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/rehype-prism-plus": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/rehype-prism-plus/-/rehype-prism-plus-2.0.2.tgz",
"integrity": "sha512-jTHb8ZtQHd2VWAAKeCINgv/8zNEF0+LesmwJak69GemoPVN9/8fGEARTvqOpKqmN57HwaM9z8UKBVNVJe8zggw==",
"license": "MIT",
"dependencies": {
"hast-util-to-string": "^3.0.1",
"parse-numeric-range": "^1.3.0",
"refractor": "^5.0.0",
"rehype-parse": "^9.0.1",
"unist-util-filter": "^5.0.1",
"unist-util-visit": "^5.1.0"
}
},
"node_modules/rehype-recma": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/rehype-recma/-/rehype-recma-1.0.0.tgz",
@ -3087,6 +3238,17 @@
"url": "https://opencollective.com/unified"
}
},
"node_modules/unist-util-filter": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/unist-util-filter/-/unist-util-filter-5.0.1.tgz",
"integrity": "sha512-pHx7D4Zt6+TsfwylH9+lYhBhzyhEnCXs/lbq/Hstxno5z4gVdyc2WEW0asfjGKPyG4pEKrnBv5hdkO6+aRnQJw==",
"license": "MIT",
"dependencies": {
"@types/unist": "^3.0.0",
"unist-util-is": "^6.0.0",
"unist-util-visit-parents": "^6.0.0"
}
},
"node_modules/unist-util-is": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.1.tgz",
@ -3197,6 +3359,20 @@
"url": "https://opencollective.com/unified"
}
},
"node_modules/vfile-location": {
"version": "5.0.3",
"resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-5.0.3.tgz",
"integrity": "sha512-5yXvWDEgqeiYiBe1lbxYF7UMAIm/IcopxMHrMQDq3nvKcjPKIhZklUKL+AE7J7uApI4kwe2snsK+eI6UTj9EHg==",
"license": "MIT",
"dependencies": {
"@types/unist": "^3.0.0",
"vfile": "^6.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/vfile-message": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-4.0.3.tgz",
@ -3211,6 +3387,16 @@
"url": "https://opencollective.com/unified"
}
},
"node_modules/web-namespaces": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/web-namespaces/-/web-namespaces-2.0.1.tgz",
"integrity": "sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==",
"license": "MIT",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
}
},
"node_modules/ws": {
"version": "8.19.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.19.0.tgz",

View file

@ -15,6 +15,7 @@
"@11ty/eleventy-plugin-rss": "^2.0.4",
"@mdx-js/mdx": "^3.1.1",
"react": "^19.2.3",
"react-dom": "^19.2.3"
"react-dom": "^19.2.3",
"rehype-prism-plus": "^2.0.2"
}
}

21
site-src/ccgoto.mdx Normal file
View file

@ -0,0 +1,21 @@
---
title: Emulating GOTO in Scheme with continuations
description: GOTO sucks and is evil and I hate it, but what if there were parentheses? `call/cc` is kinda like goto, so let's make goto.
tags: post,short
date: 2026-02-18 14:28:46 -5
---
```basic
10 PRINT "Hello, world!"
20 GOTO 10
```
Here is some `inline code`.
```js
console.log("Surely, javascript is supported");
```
```ruby
3.tap.tap.tap.tap.tap.tap.tap.tap.tap.tap.tap.tap.tap.tap.tap.tap.tap.tap.tap.tap.tap.tap.tap.tap.tap.tap.
```

View file

@ -16,7 +16,7 @@ Importantly, literally nothing changes for (cool) users who (righteously) block
It is perfect [progressive enhancement](https://en.wikipedia.org/wiki/Progressive_enhancement).
## Steps
1. Add htmx to your `<head>`: `<script src="https://cdn.jsdelivr.net/npm/htmx.org@2.0.8/dist/htmx.min.js"></script>`.
1. Add htmx to your `<head>`: <code class="long">{`<script src="https://cdn.jsdelivr.net/npm/htmx.org@2.0.8/dist/htmx.min.js"></script>`}</code>
2. Add `hx-boost="true"` to your `<body>`.
3. Add `hx-preserve="true"` to stuff that is static between pages (probably a sidebar/footer). Add a unique `id` if it doesn't already have one.
4. Be happy that it works with and without JavaScript.

View file

@ -11,6 +11,7 @@ title: terezi.pyrope.net
<link rel="stylesheet" href="/res/main.css">
<link rel="stylesheet" type="text/css" href="/res/charis.css"/>
<link rel="stylesheet" type="text/css" href="/res/syntax-highlighting.css"/>
<link rel="icon" href="/res/pyralspite.webp">

View file

@ -123,7 +123,7 @@ pre {
/* yeah what the heck let's do 100 (for rust's sake) */
/* reducing the font-size a touch makes this more than reasonable methinks */
/* nvm */
width: min(80ch, 95vw);
/* width: min(80.5ch, 95vw); */
margin-inline: auto;
font-size: 1rem;
}
@ -161,10 +161,15 @@ h2 > a {
}
p,
blockquote {
blockquote,
pre {
margin-block: 0 8pt;
}
pre {
overflow: auto;
}
code,
pre {
/* kde default i think; looks nice, so i want to keep it consistent */
@ -173,11 +178,8 @@ pre {
}
/* mmmm */
code {
code.long {
white-space: pre-wrap;
/*
color: #008282;
filter: grayscale(0.7); */
}
pre > code {
@ -367,3 +369,16 @@ footer > * {
min-width: 0;
margin: 0;
}
@media (prefers-color-scheme: dark) {
code,
pre {
background-color: #282828;
}
}
@media (prefers-color-scheme: light) {
code,
pre {
background-color: #fbf0c9;
}
}

View file

@ -0,0 +1,294 @@
/*
* For both of these, I, mehbark, made some silly tweaks to fit my own needs. Don't use this!
*/
@media (prefers-color-scheme: dark) {
/**
* Gruvbox dark theme
*
* Adapted from a theme based on:
* Vim Gruvbox dark Theme (https://github.com/morhetz/gruvbox)
*
* @author Azat S. <to@azat.io>
* @version 1.0
*/
code,
pre[class*="language-"] {
color: #ebdbb2; /* fg1 / fg */
font-family: Consolas, Monaco, "Andale Mono", monospace;
direction: ltr;
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
line-height: 1.5;
-moz-tab-size: 4;
-o-tab-size: 4;
tab-size: 4;
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
}
pre[class*="language-"]::-moz-selection,
pre[class*="language-"] ::-moz-selection,
code::-moz-selection,
code ::-moz-selection {
color: #fbf1c7; /* fg0 */
background: #7c6f64; /* bg4 */
}
pre[class*="language-"]::selection,
pre[class*="language-"] ::selection,
code::selection,
code ::selection {
color: #fbf1c7; /* fg0 */
background: #7c6f64; /* bg4 */
}
/* Code blocks */
pre[class*="language-"] {
padding: 1em;
margin: 0.5em 0;
overflow: auto;
}
/* :not(pre) > code[class*="language-"],
pre[class*="language-"] {
background: #1d2021; /* bg0_h
} */
/* Inline code */
:not(pre) > code[class*="language-"] {
padding: 0.1em;
border-radius: 0.3em;
}
.token.comment,
.token.prolog,
.token.cdata {
color: #a89984; /* fg4 / gray1 */
}
.token.delimiter,
.token.boolean,
.token.keyword,
.token.selector,
.token.important,
.token.atrule {
color: #fb4934; /* red2 */
}
.token.operator,
.token.punctuation,
.token.attr-name {
color: #a89984; /* fg4 / gray1 */
}
.token.tag,
.token.tag .punctuation,
.token.doctype,
.token.builtin {
color: #fabd2f; /* yellow2 */
}
.token.entity,
.token.number,
.token.symbol {
color: #d3869b; /* purple2 */
}
.token.property,
.token.constant,
.token.variable {
color: #fb4934; /* red2 */
}
.token.string,
.token.char {
color: #b8bb26; /* green2 */
}
.token.attr-value,
.token.attr-value .punctuation {
color: #a89984; /* fg4 / gray1 */
}
.token.url {
color: #b8bb26; /* green2 */
text-decoration: underline;
}
.token.function {
color: #fabd2f; /* yellow2 */
}
.token.regex {
background: #b8bb26; /* green2 */
}
.token.bold {
font-weight: bold;
}
.token.italic {
font-style: italic;
}
.token.inserted {
background: #a89984; /* fg4 / gray1 */
}
.token.deleted {
background: #fb4934; /* red2 */
}
}
@media (prefers-color-scheme: light) {
/**
* Gruvbox light theme
*
* Based on Gruvbox: https://github.com/morhetz/gruvbox
* Adapted from PrismJS gruvbox-dark theme: https://github.com/schnerring/prism-themes/blob/master/themes/prism-gruvbox-dark.css
*
* @author Michael Schnerring (https://schnerring.net)
* @version 1.0
*/
code,
pre[class*="language-"] {
color: #3c3836; /* fg1 / fg */
font-family: Consolas, Monaco, "Andale Mono", monospace;
direction: ltr;
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
line-height: 1.5;
-moz-tab-size: 4;
-o-tab-size: 4;
tab-size: 4;
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
}
pre[class*="language-"]::-moz-selection,
pre[class*="language-"] ::-moz-selection,
code::-moz-selection,
code ::-moz-selection {
color: #282828; /* fg0 */
background: #a89984; /* bg4 */
}
pre[class*="language-"]::selection,
pre[class*="language-"] ::selection,
code::selection,
code::selection {
color: #282828; /* fg0 */
background: #a89984; /* bg4 */
}
/* Code blocks */
pre[class*="language-"] {
padding: 1em;
margin: 0.5em 0;
overflow: auto;
}
/* :not(pre) > code[class*="language-"],
pre[class*="language-"] {
background: #f9f5d7; /* bg0_h
} */
/* Inline code */
:not(pre) > code[class*="language-"] {
padding: 0.1em;
border-radius: 0.3em;
}
.token.comment,
.token.prolog,
.token.cdata {
color: #7c6f64; /* fg4 / gray1 */
}
.token.delimiter,
.token.boolean,
.token.keyword,
.token.selector,
.token.important,
.token.atrule {
color: #9d0006; /* red2 */
}
.token.operator,
.token.punctuation,
.token.attr-name {
color: #7c6f64; /* fg4 / gray1 */
}
.token.tag,
.token.tag .punctuation,
.token.doctype,
.token.builtin {
color: #b57614; /* yellow2 */
}
.token.entity,
.token.number,
.token.symbol {
color: #8f3f71; /* purple2 */
}
.token.property,
.token.constant,
.token.variable {
color: #9d0006; /* red2 */
}
.token.string,
.token.char {
color: #797403; /* green2 */
}
.token.attr-value,
.token.attr-value .punctuation {
color: #7c6f64; /* fg4 / gray1 */
}
.token.url {
color: #797403; /* green2 */
text-decoration: underline;
}
.token.function {
color: #b57614; /* yellow2 */
}
.token.regex {
background: #797403; /* green2 */
}
.token.bold {
font-weight: bold;
}
.token.italic {
font-style: italic;
}
.token.inserted {
background: #7c6f64; /* fg4 / gray1 */
}
.token.deleted {
background: #9d0006; /* red2 */
}
}