mirror of
https://github.com/osmarks/website
synced 2026-03-20 06:49:44 +00:00
copyedits, tag system, new post(s)
This commit is contained in:
164
src/dark-theme-highlight.css
Normal file
164
src/dark-theme-highlight.css
Normal file
@@ -0,0 +1,164 @@
|
||||
pre code.hljs {
|
||||
display: block;
|
||||
overflow-x: auto;
|
||||
padding: 1em
|
||||
}
|
||||
code.hljs {
|
||||
padding: 3px 5px
|
||||
}
|
||||
/*!
|
||||
Theme: PaperColor Dark
|
||||
Author: Jon Leopard (http://github.com/jonleopard) based on PaperColor Theme (https://github.com/NLKNguyen/papercolor-theme)
|
||||
License: ~ MIT (or more permissive) [via base16-schemes-source]
|
||||
Maintainer: @highlightjs/core-team
|
||||
Version: 2021.09.0
|
||||
*/
|
||||
/*
|
||||
WARNING: DO NOT EDIT THIS FILE DIRECTLY.
|
||||
|
||||
This theme file was auto-generated from the Base16 scheme papercolor-dark
|
||||
by the Highlight.js Base16 template builder.
|
||||
|
||||
- https://github.com/highlightjs/base16-highlightjs
|
||||
*/
|
||||
/*
|
||||
base00 #111 Default Background
|
||||
base01 #af005f Lighter Background (Used for status bars, line number and folding marks)
|
||||
base02 #5faf00 Selection Background
|
||||
base03 #d7af5f Comments, Invisibles, Line Highlighting
|
||||
base04 #5fafd7 Dark Foreground (Used for status bars)
|
||||
base05 #ccc Default Foreground, Caret, Delimiters, Operators
|
||||
base06 #d7875f Light Foreground (Not often used)
|
||||
base07 #d0d0d0 Light Background (Not often used)
|
||||
base08 #585858 Variables, XML Tags, Markup Link Text, Markup Lists, Diff Deleted
|
||||
base09 #5faf5f Integers, Boolean, Constants, XML Attributes, Markup Link Url
|
||||
base0A #afd700 Classes, Markup Bold, Search Text Background
|
||||
base0B #af87d7 Strings, Inherited Class, Markup Code, Diff Inserted
|
||||
base0C #ffaf00 Support, Regular Expressions, Escape Characters, Markup Quotes
|
||||
base0D #ff5faf Functions, Methods, Attribute IDs, Headings
|
||||
base0E #00afaf Keywords, Storage, Selector, Markup Italic, Diff Changed
|
||||
base0F #5f8787 Deprecated, Opening/Closing Embedded Language Tags, e.g. <?php ?>
|
||||
*/
|
||||
pre code.hljs {
|
||||
display: block;
|
||||
overflow-x: auto;
|
||||
padding: 1em;
|
||||
border: 1px solid var(--box-border);
|
||||
}
|
||||
code.hljs {
|
||||
padding: 3px 5px
|
||||
}
|
||||
.hljs {
|
||||
color: #ccc;
|
||||
background: #111
|
||||
}
|
||||
.hljs::selection,
|
||||
.hljs ::selection {
|
||||
background-color: #5faf00;
|
||||
color: #ccc
|
||||
}
|
||||
/* purposely do not highlight these things */
|
||||
.hljs-formula,
|
||||
.hljs-params,
|
||||
.hljs-property {
|
||||
|
||||
}
|
||||
/* base03 - #d7af5f - Comments, Invisibles, Line Highlighting */
|
||||
.hljs-comment {
|
||||
color: #d7af5f
|
||||
}
|
||||
/* base04 - #5fafd7 - Dark Foreground (Used for status bars) */
|
||||
.hljs-tag {
|
||||
color: #5fafd7
|
||||
}
|
||||
/* base05 - #ccc - Default Foreground, Caret, Delimiters, Operators */
|
||||
.hljs-subst,
|
||||
.hljs-punctuation,
|
||||
.hljs-operator {
|
||||
color: #ccc
|
||||
}
|
||||
.hljs-operator {
|
||||
opacity: 0.7
|
||||
}
|
||||
/* base08 - Variables, XML Tags, Markup Link Text, Markup Lists, Diff Deleted */
|
||||
.hljs-bullet,
|
||||
.hljs-variable,
|
||||
.hljs-template-variable,
|
||||
.hljs-selector-tag,
|
||||
.hljs-name,
|
||||
.hljs-deletion {
|
||||
color: #585858
|
||||
}
|
||||
/* base09 - Integers, Boolean, Constants, XML Attributes, Markup Link Url */
|
||||
.hljs-symbol,
|
||||
.hljs-number,
|
||||
.hljs-link,
|
||||
.hljs-attr,
|
||||
.hljs-variable.constant_,
|
||||
.hljs-literal {
|
||||
color: #5faf5f
|
||||
}
|
||||
/* base0A - Classes, Markup Bold, Search Text Background */
|
||||
.hljs-title,
|
||||
.hljs-class .hljs-title,
|
||||
.hljs-title.class_ {
|
||||
color: #afd700
|
||||
}
|
||||
.hljs-strong {
|
||||
font-weight: bold;
|
||||
color: #afd700
|
||||
}
|
||||
/* base0B - Strings, Inherited Class, Markup Code, Diff Inserted */
|
||||
.hljs-code,
|
||||
.hljs-addition,
|
||||
.hljs-title.class_.inherited__,
|
||||
.hljs-string {
|
||||
color: #af87d7
|
||||
}
|
||||
/* base0C - Support, Regular Expressions, Escape Characters, Markup Quotes */
|
||||
/* guessing */
|
||||
.hljs-built_in,
|
||||
.hljs-doctag,
|
||||
.hljs-quote,
|
||||
.hljs-keyword.hljs-atrule,
|
||||
.hljs-regexp {
|
||||
color: #ffaf00
|
||||
}
|
||||
/* base0D - Functions, Methods, Attribute IDs, Headings */
|
||||
.hljs-function .hljs-title,
|
||||
.hljs-attribute,
|
||||
.ruby .hljs-property,
|
||||
.hljs-title.function_,
|
||||
.hljs-section {
|
||||
color: #ff5faf
|
||||
}
|
||||
/* base0E - Keywords, Storage, Selector, Markup Italic, Diff Changed */
|
||||
/* .hljs-selector-id, */
|
||||
/* .hljs-selector-class, */
|
||||
/* .hljs-selector-attr, */
|
||||
/* .hljs-selector-pseudo, */
|
||||
.hljs-type,
|
||||
.hljs-template-tag,
|
||||
.diff .hljs-meta,
|
||||
.hljs-keyword {
|
||||
color: #00afaf
|
||||
}
|
||||
.hljs-emphasis {
|
||||
color: #00afaf;
|
||||
font-style: italic
|
||||
}
|
||||
/* base0F - Deprecated, Opening/Closing Embedded Language Tags, e.g. <?php ?> */
|
||||
/*
|
||||
prevent top level .keyword and .string scopes
|
||||
from leaking into meta by accident
|
||||
*/
|
||||
.hljs-meta,
|
||||
.hljs-meta .hljs-keyword,
|
||||
.hljs-meta .hljs-string {
|
||||
color: #5f8787
|
||||
}
|
||||
/* for v10 compatible themes */
|
||||
.hljs-meta .hljs-keyword,
|
||||
.hljs-meta-keyword {
|
||||
font-weight: bold
|
||||
}
|
||||
@@ -43,7 +43,7 @@
|
||||
"Overcoming Bias": "https://www.overcomingbias.com/feed",
|
||||
"Construction Physics": "https://www.construction-physics.com/feed",
|
||||
"Factorio": "https://www.factorio.com/blog/rss",
|
||||
"The Eldraeverse": "https://eldraeverse.com/feed/",
|
||||
"The Eldraeverse": "https://eldraeverse.com/rss/",
|
||||
"ServeTheHome": "https://www.servethehome.com/feed/",
|
||||
"Graphcore Research": "https://graphcore-research.github.io/feed.xml",
|
||||
"ToughSF": "https://toughsf.blogspot.com/rss.xml",
|
||||
@@ -58,7 +58,10 @@
|
||||
"Mythic Beasts": "https://www.mythic-beasts.com/blog/feed/",
|
||||
"Tales from the Void": "https://randomsprint.substack.com/feed",
|
||||
"Max Barry": "https://maxbarry.com/index.rss",
|
||||
"Real World Tech": "https://www.realworldtech.com/feed/"
|
||||
"Real World Tech": "https://www.realworldtech.com/feed/",
|
||||
"Entropic Thoughts": "https://entropicthoughts.com/feed",
|
||||
"phils web site": "https://phils-web-site.net/rss.xml",
|
||||
"Sixty Degrees North": "https://sixtydegreesnorth.substack.com/feed.xml"
|
||||
},
|
||||
"dateFormat": "YYYY-MM-DD",
|
||||
"microblogSource": "https://b.osmarks.net/outbox",
|
||||
@@ -92,5 +95,14 @@
|
||||
["rhombic_dodecahedron.gif", "https://en.wikipedia.org/wiki/Rhombic_dodecahedron"],
|
||||
["zeroptr.gif", "https://zptr.cc/88x31/"]
|
||||
],
|
||||
"mycorrhiza": "https://docs.osmarks.net"
|
||||
"mycorrhiza": "https://docs.osmarks.net",
|
||||
"tagColors": {
|
||||
"ai": "#703be7",
|
||||
"hardware": "#5e819d",
|
||||
"fiction": "#ff028d",
|
||||
"economics": "#15b01a",
|
||||
"opinion": "#fdaa48",
|
||||
"own tech": "#04d8b2",
|
||||
"maths": "#f8481c"
|
||||
}
|
||||
}
|
||||
|
||||
42
src/index.js
42
src/index.js
@@ -32,6 +32,7 @@ const pLimit = require("p-limit")
|
||||
const json5 = require("json5")
|
||||
const readability = require("@mozilla/readability")
|
||||
const { JSDOM } = require("jsdom")
|
||||
const hljs = require("highlight.js")
|
||||
|
||||
const fts = require("./fts.mjs")
|
||||
|
||||
@@ -164,12 +165,13 @@ const renderContainer = (tokens, idx) => {
|
||||
options[k] += " " + arg
|
||||
} else {
|
||||
[k, ...vs] = arg.split("=")
|
||||
let vEmpty = vs.length == 0
|
||||
v = vs.join("=")
|
||||
if (v && v[0] == '"') {
|
||||
inQuotes = true
|
||||
v = v.slice(1)
|
||||
}
|
||||
options[k] = v ?? true
|
||||
options[k] = vEmpty ? true : v ?? true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,7 +217,13 @@ const md = new MarkdownIt({
|
||||
html: true,
|
||||
highlight: (code, language) => {
|
||||
if (language === "squiggle") {
|
||||
return `<textarea class="squiggle" rows=${code.split("\n").length}>${md.utils.escapeHtml(code.trim())}</textarea>`
|
||||
return `<textarea class=squiggle rows=${code.split("\n").length}>${md.utils.escapeHtml(code.trim())}</textarea>`
|
||||
}
|
||||
if (language && hljs.getLanguage(language)) {
|
||||
try {
|
||||
const hl = hljs.highlight(code, { language }).value
|
||||
return `<pre class=wider><code class="hljs">${hl}</code></pre>`
|
||||
} catch(e) {}
|
||||
}
|
||||
return "" // default escaping
|
||||
}
|
||||
@@ -320,6 +328,16 @@ const applyTemplate = async (template, input, getOutput, options = {}) => {
|
||||
|
||||
const addGuids = R.map(x => ({ ...x, guid: uuid.v5(`${x.lastUpdate}:${x.slug}`, "9111a1fc-59c3-46f0-9ab4-47c607a958f2") }))
|
||||
|
||||
const processTags = meta => {
|
||||
meta.accentColor = null
|
||||
for (const tag of meta.tags ?? []) {
|
||||
if (globalData.tagColors[tag]) {
|
||||
meta.accentColor = globalData.tagColors[tag]
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const processExperiments = async () => {
|
||||
const templates = globalData.templates
|
||||
const experiments = await loadDir(experimentDir, (subdirectory, basename) => {
|
||||
@@ -336,6 +354,7 @@ const processExperiments = async () => {
|
||||
}
|
||||
}))
|
||||
const indexPath = path.join(out, "index.html")
|
||||
processTags(page.data)
|
||||
fts.pushEntry("experiment", {
|
||||
url: "/" + page.data.slug,
|
||||
title: page.data.title,
|
||||
@@ -360,6 +379,7 @@ const processBlog = async () => {
|
||||
meta.slug = meta.slug || removeExtension(basename)
|
||||
meta.wordCount = page.content.split(/\s+/).map(x => x.trim()).filter(x => x).length
|
||||
meta.haveSidenotes = true
|
||||
processTags(meta)
|
||||
const [html, urls] = renderMarkdown(page.content)
|
||||
meta.content = html
|
||||
meta.references = []
|
||||
@@ -593,6 +613,24 @@ const compileCSS = async () => {
|
||||
css += "\n"
|
||||
css += await fsp.readFile(path.join(srcDir, "comments.css"))
|
||||
globalData.css = css
|
||||
|
||||
const lightThemeHighlight = await fsp.readFile(path.join(srcDir, "light-theme-highlight.css"))
|
||||
const darkThemeHighlight = await fsp.readFile(path.join(srcDir, "dark-theme-highlight.css"))
|
||||
|
||||
// abuse SASS compiler to do minification
|
||||
const highlightCSS = sass.compileString(`
|
||||
${lightThemeHighlight}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
${darkThemeHighlight}
|
||||
}
|
||||
`, {
|
||||
style: "compressed",
|
||||
indentedSyntax: false,
|
||||
charset: false
|
||||
})
|
||||
|
||||
await fsp.writeFile(path.join(outAssets, "highlight.min.css"), highlightCSS.css)
|
||||
}
|
||||
|
||||
const loadTemplates = async () => {
|
||||
|
||||
164
src/light-theme-highlight.css
Normal file
164
src/light-theme-highlight.css
Normal file
@@ -0,0 +1,164 @@
|
||||
pre code.hljs {
|
||||
display: block;
|
||||
overflow-x: auto;
|
||||
padding: 1em
|
||||
}
|
||||
code.hljs {
|
||||
padding: 3px 5px
|
||||
}
|
||||
/*!
|
||||
Theme: PaperColor Light
|
||||
Author: Jon Leopard (http://github.com/jonleopard) based on PaperColor Theme (https://github.com/NLKNguyen/papercolor-theme)
|
||||
License: ~ MIT (or more permissive) [via base16-schemes-source]
|
||||
Maintainer: @highlightjs/core-team
|
||||
Version: 2021.09.0
|
||||
*/
|
||||
/*
|
||||
WARNING: DO NOT EDIT THIS FILE DIRECTLY.
|
||||
|
||||
This theme file was auto-generated from the Base16 scheme papercolor-light
|
||||
by the Highlight.js Base16 template builder.
|
||||
|
||||
- https://github.com/highlightjs/base16-highlightjs
|
||||
*/
|
||||
/*
|
||||
base00 #eeeeee Default Background
|
||||
base01 #af0000 Lighter Background (Used for status bars, line number and folding marks)
|
||||
base02 #00ee00 Selection Background
|
||||
base03 #5f8700 Comments, Invisibles, Line Highlighting
|
||||
base04 #0087af Dark Foreground (Used for status bars)
|
||||
base05 #000000 Default Foreground, Caret, Delimiters, Operators
|
||||
base06 #005f87 Light Foreground (Not often used)
|
||||
base07 #878787 Light Background (Not often used)
|
||||
base08 #bcbcbc Variables, XML Tags, Markup Link Text, Markup Lists, Diff Deleted
|
||||
base09 #d70000 Integers, Boolean, Constants, XML Attributes, Markup Link Url
|
||||
base0A #d70087 Classes, Markup Bold, Search Text Background
|
||||
base0B #8700af Strings, Inherited Class, Markup Code, Diff Inserted
|
||||
base0C #a83c09 Support, Regular Expressions, Escape Characters, Markup Quotes
|
||||
base0D #a83c09 Functions, Methods, Attribute IDs, Headings
|
||||
base0E #005faf Keywords, Storage, Selector, Markup Italic, Diff Changed
|
||||
base0F #005f87 Deprecated, Opening/Closing Embedded Language Tags, e.g. <?php ?>
|
||||
*/
|
||||
pre code.hljs {
|
||||
display: block;
|
||||
overflow-x: auto;
|
||||
padding: 1em;
|
||||
border: 1px solid var(--box-border);
|
||||
}
|
||||
code.hljs {
|
||||
padding: 3px 5px
|
||||
}
|
||||
.hljs {
|
||||
color: #000000;
|
||||
background: #eeeeee
|
||||
}
|
||||
.hljs::selection,
|
||||
.hljs ::selection {
|
||||
background-color: #00ee00;
|
||||
color: #000000
|
||||
}
|
||||
/* purposely do not highlight these things */
|
||||
.hljs-formula,
|
||||
.hljs-params,
|
||||
.hljs-property {
|
||||
|
||||
}
|
||||
/* base03 - #5f8700 - Comments, Invisibles, Line Highlighting */
|
||||
.hljs-comment {
|
||||
color: #5f8700
|
||||
}
|
||||
/* base04 - #0087af - Dark Foreground (Used for status bars) */
|
||||
.hljs-tag {
|
||||
color: #0087af
|
||||
}
|
||||
/* base05 - #000000 - Default Foreground, Caret, Delimiters, Operators */
|
||||
.hljs-subst,
|
||||
.hljs-punctuation,
|
||||
.hljs-operator {
|
||||
color: #000000
|
||||
}
|
||||
.hljs-operator {
|
||||
opacity: 0.7
|
||||
}
|
||||
/* base08 - Variables, XML Tags, Markup Link Text, Markup Lists, Diff Deleted */
|
||||
.hljs-bullet,
|
||||
.hljs-variable,
|
||||
.hljs-template-variable,
|
||||
.hljs-selector-tag,
|
||||
.hljs-name,
|
||||
.hljs-deletion {
|
||||
color: #bcbcbc
|
||||
}
|
||||
/* base09 - Integers, Boolean, Constants, XML Attributes, Markup Link Url */
|
||||
.hljs-symbol,
|
||||
.hljs-number,
|
||||
.hljs-link,
|
||||
.hljs-attr,
|
||||
.hljs-variable.constant_,
|
||||
.hljs-literal {
|
||||
color: #d70000
|
||||
}
|
||||
/* base0A - Classes, Markup Bold, Search Text Background */
|
||||
.hljs-title,
|
||||
.hljs-class .hljs-title,
|
||||
.hljs-title.class_ {
|
||||
color: #d70087
|
||||
}
|
||||
.hljs-strong {
|
||||
font-weight: bold;
|
||||
color: #d70087
|
||||
}
|
||||
/* base0B - Strings, Inherited Class, Markup Code, Diff Inserted */
|
||||
.hljs-code,
|
||||
.hljs-addition,
|
||||
.hljs-title.class_.inherited__,
|
||||
.hljs-string {
|
||||
color: #8700af
|
||||
}
|
||||
/* base0C - Support, Regular Expressions, Escape Characters, Markup Quotes */
|
||||
/* guessing */
|
||||
.hljs-built_in,
|
||||
.hljs-doctag,
|
||||
.hljs-quote,
|
||||
.hljs-keyword.hljs-atrule,
|
||||
.hljs-regexp {
|
||||
color: #a83c09
|
||||
}
|
||||
/* base0D - Functions, Methods, Attribute IDs, Headings */
|
||||
.hljs-function .hljs-title,
|
||||
.hljs-attribute,
|
||||
.ruby .hljs-property,
|
||||
.hljs-title.function_,
|
||||
.hljs-section {
|
||||
color: #a83c09
|
||||
}
|
||||
/* base0E - Keywords, Storage, Selector, Markup Italic, Diff Changed */
|
||||
/* .hljs-selector-id, */
|
||||
/* .hljs-selector-class, */
|
||||
/* .hljs-selector-attr, */
|
||||
/* .hljs-selector-pseudo, */
|
||||
.hljs-type,
|
||||
.hljs-template-tag,
|
||||
.diff .hljs-meta,
|
||||
.hljs-keyword {
|
||||
color: #005faf
|
||||
}
|
||||
.hljs-emphasis {
|
||||
color: #005faf;
|
||||
font-style: italic
|
||||
}
|
||||
/* base0F - Deprecated, Opening/Closing Embedded Language Tags, e.g. <?php ?> */
|
||||
/*
|
||||
prevent top level .keyword and .string scopes
|
||||
from leaking into meta by accident
|
||||
*/
|
||||
.hljs-meta,
|
||||
.hljs-meta .hljs-keyword,
|
||||
.hljs-meta .hljs-string {
|
||||
color: #005f87
|
||||
}
|
||||
/* for v10 compatible themes */
|
||||
.hljs-meta .hljs-keyword,
|
||||
.hljs-meta-keyword {
|
||||
font-weight: bold
|
||||
}
|
||||
@@ -606,5 +606,24 @@
|
||||
"accel": ""
|
||||
},
|
||||
excerpt: "The software brained answer is that for precision insensitive workloads, you effectively double your bandwidth from caches/device mem/host mem. But there's a lot more to it."
|
||||
}
|
||||
},
|
||||
"https://www.hc33.hotchips.org/assets/program/conference/day2/HC2021.DESRES.AdamButts.v03.pdf": {
|
||||
title: "The ANTON 3 ASIC: a Fire-Breathing Monster for Molecular Dynamics Simulation",
|
||||
author: "DE Shaw Research",
|
||||
date: "2021-08-24"
|
||||
},
|
||||
"https://datasets.osmarks.net/counts.csv": {
|
||||
title: "Pile Number Frequency Data",
|
||||
website: "osmarks datasets"
|
||||
},
|
||||
"https://isr.umd.edu/Labs/CIM/miscs/wmsor97.pdf": {
|
||||
title: "Petri Nets: Tutorial and Applications",
|
||||
author: ["Jeffrey W. Herrmann", "Edward Lin"],
|
||||
date: "1997-11-05"
|
||||
},
|
||||
"/assets/misc/commutative_grammars.pdf": {
|
||||
title: "Commutative Grammars",
|
||||
author: ["S. Crespi-Reghizzi", "D. Mandrioli"],
|
||||
date: "1975-05-05"
|
||||
},
|
||||
}
|
||||
|
||||
@@ -7,12 +7,12 @@ $navbar-width: 20rem
|
||||
box-sizing: border-box
|
||||
|
||||
:root
|
||||
// worth considering: #d9facc?
|
||||
--box-bg: #d0faab
|
||||
--box-border: black
|
||||
// xkcd bluegreen
|
||||
--link: #017a79
|
||||
// xkcd dark blue green
|
||||
--visited-link: #005249
|
||||
--visited-link: #013c7a
|
||||
--block-lightness: 85%
|
||||
--overlay-opacity: 0.8
|
||||
|
||||
@@ -330,8 +330,7 @@ $hl-border: 3px
|
||||
--box-border: #004020
|
||||
// bright teal
|
||||
--link: #01f9c6
|
||||
// aqua green
|
||||
--visited-link: #12e193
|
||||
--visited-link: #01f9f9
|
||||
--block-lightness: 20%
|
||||
--overlay-opacity: 0.5
|
||||
|
||||
@@ -447,11 +446,21 @@ table
|
||||
background: #b1d1fc
|
||||
background: var(--box-bg)
|
||||
padding: 12px
|
||||
position: relative
|
||||
.title
|
||||
font-size: 1.1em
|
||||
font-family: $headers
|
||||
font-weight: 600
|
||||
|
||||
.box::after
|
||||
top: 0
|
||||
right: 0
|
||||
height: 100%
|
||||
width: 6px
|
||||
position: absolute
|
||||
content: ""
|
||||
background: var(--stripe, transparent)
|
||||
|
||||
#citebox
|
||||
width: 100%
|
||||
|
||||
@@ -493,3 +502,7 @@ textarea.squiggle
|
||||
.excerpt
|
||||
font-size: 0.9em
|
||||
font-style: italic
|
||||
|
||||
|
||||
.numeric-table
|
||||
text-align: right
|
||||
|
||||
Reference in New Issue
Block a user