add mono font and rework codeblock css

This commit is contained in:
Joseph Montanaro 2023-12-20 07:45:26 -08:00
parent b5ca20d739
commit a6735c45f4
8 changed files with 41 additions and 117 deletions

View File

@ -6,7 +6,6 @@
</script> </script>
<style lang="scss"> <style lang="scss">
.h { .h {
position: relative; position: relative;
} }
@ -45,7 +44,7 @@
} }
svg { svg {
/* undo the reset that makes svg's block */ /* undo the reset that makes images block */
display: inline; display: inline;
width: 1em; width: 1em;
/* tiny tweak for optical alignment */ /* tiny tweak for optical alignment */

View File

@ -1,5 +1,6 @@
<script context="module"> <script context="module">
import '$styles/prose.scss'; import '$styles/prose.scss';
import '$styles/code.scss';
import { onMount } from 'svelte'; import { onMount } from 'svelte';
import { formatDate } from './datefmt.js'; import { formatDate } from './datefmt.js';
@ -23,21 +24,23 @@
<style> <style>
.page { .page {
/* 3-column grid: left gutter, center content, and right gutter */
display: grid; display: grid;
grid-template-columns: minmax(0, 1fr) minmax(0, var(--content-width)) minmax(0, 1fr); grid-template-columns: minmax(0, 1fr) minmax(0, var(--content-width)) minmax(0, 1fr);
/* a bit of breathing room for narrow screens */
padding: 0 0.5rem; padding: 0 0.5rem;
} }
/* container for the table of contents */
.left-gutter {
grid-column: 1 / 2;
justify-self: end;
}
.title { .title {
grid-column: 2 / 3; grid-column: 2 / 3;
} }
.left-gutter {
grid-column: 1 / 2;
justify-self: end;
}
.subtitle { .subtitle {
font-size: 0.9em; font-size: 0.9em;
font-style: italic; font-style: italic;
@ -100,7 +103,6 @@
<meta property="og:url" content="https://blog.jfmonty2.com/{slug}"> <meta property="og:url" content="https://blog.jfmonty2.com/{slug}">
<meta property="og:description" content={description}> <meta property="og:description" content={description}>
<meta property="og:site_name" content="Joe's Blog"> <meta property="og:site_name" content="Joe's Blog">
<link rel="stylesheet" href="/prism-dracula.css" />
</svelte:head> </svelte:head>
<div class="page"> <div class="page">

23
src/styles/code.scss Normal file
View File

@ -0,0 +1,23 @@
@import 'prism-dracula';
@font-face {
font-family: 'Hack';
font-style: normal;
font-weight: 400;
src: url(/Hack-Regular.woff2) format('woff2');
font-display: block;
}
code {
padding: 0.05rem 0.2rem 0.1rem;
background: #eee;
border-radius: 0.2rem;
font-size: 0.75em;
font-family: 'Hack', monospace;
}
pre > code[class*="language-"] {
font-size: 0.75em;
font-family: 'Hack', monospace;
}

View File

@ -9,14 +9,6 @@
font-display: block; font-display: block;
} }
@font-face {
font-family: 'Baskerville';
font-style: normal;
font-weight: 400;
src: url(/Baskerville-Regular.woff2) format('woff2');
font-display: block;
}
:root { :root {
--content-size: 1.25rem; --content-size: 1.25rem;
--content-line-height: 1.3; --content-line-height: 1.3;

View File

@ -1,3 +1,11 @@
@font-face {
font-family: 'Baskerville';
font-style: normal;
font-weight: 400;
src: url(/Baskerville-Regular.woff2) format('woff2');
font-display: block;
}
h1, h2, h3, h4, h5, h6 { h1, h2, h3, h4, h5, h6 {
font-family: -apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Ubuntu, Arial, sans-serif; font-family: -apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Ubuntu, Arial, sans-serif;
font-weight: 600; font-weight: 600;
@ -29,16 +37,3 @@ h1, h2, h3, h4 {
p { p {
margin-bottom: 0.8em; margin-bottom: 0.8em;
} }
code {
background: #eee;
border-radius: 0.2rem;
font-family: Consolas, monospace;
font-size: 0.75em;
padding: 0.05rem 0.2rem 0.1rem;
}
pre > code[class*="language-"] {
font-size: 1rem;
font-family: 'Consolas', monospace;
}

BIN
static/Hack-Regular.woff2 Normal file

Binary file not shown.

View File

@ -1,87 +0,0 @@
/* ### TYPOGRAPHY ### */
@font-face {
font-family: 'Tajawal';
font-style: normal;
font-weight: 400;
src: url(/Tajawal-Regular.woff2) format('woff2');
font-display: block;
}
@font-face {
font-family: 'Baskerville';
font-style: normal;
font-weight: 400;
src: url(/Baskerville-Regular.woff2) format('woff2');
font-display: block;
}
:root {
--content-size: 1.25rem;
--content-line-height: 1.3;
--content-color: #1e1e1e;
--content-color-faded: #555;
--accent-color: #8c0606;
}
html {
font-family: 'Tajawal', sans-serif;
font-size: var(--content-size);
line-height: var(--content-line-height);
letter-spacing: -0.005em;
color: var(--content-color);
box-sizing: border-box;
}
body {
margin: 0;
--content-width: 42rem;
}
h1, h2, h3, h4, h5, h6 {
font-family: -apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Ubuntu, Arial, sans-serif;;
font-weight: 600;
color: #464646;
}
h1 {
font-variant: petite-caps;
margin-top: 0.75rem;
}
h1, h2 {
margin-bottom: 0.75rem;
}
h3 {
font-size: 1.2rem;
}
h4 {
font-size: 1.1rem;
}
h3, h4 {
margin-bottom: 0.5rem;
}
h5, h6 {
font-size: 1rem;
margin-bottom: 0;
}
p {
margin-top: 0;
margin-bottom: 1rem;
}
code {
background: #eee;
border-radius: 0.2rem;
font-family: Consolas, monospace;
font-size: 0.8em;
padding: 0.05rem 0.2rem 0.1rem;
}
pre > code {
font-size: 0.8rem;
}