From bdcc7cea6ada62a201fe9ebb845ea21323df84d4 Mon Sep 17 00:00:00 2001 From: Chris Kaczor Date: Mon, 28 Oct 2024 13:24:41 +0000 Subject: [PATCH] Update font, some cleanup --- .editorconfig | 2 +- _includes/layouts/base.njk | 4 +++ eleventy.config.js | 52 +++++++++++++++++++++++++++++++++++++- public/css/index.css | 5 ++-- 4 files changed, 59 insertions(+), 4 deletions(-) diff --git a/.editorconfig b/.editorconfig index 844771f..b09dc36 100644 --- a/.editorconfig +++ b/.editorconfig @@ -2,7 +2,7 @@ root = true [*] indent_style = tab -indent_size = 2 +indent_size = 4 end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true diff --git a/_includes/layouts/base.njk b/_includes/layouts/base.njk index 57a29a2..bd45255 100644 --- a/_includes/layouts/base.njk +++ b/_includes/layouts/base.njk @@ -7,6 +7,10 @@ + + + + {#- Uncomment this if you’d like folks to know that you used Eleventy to build your site! #} {#- #} diff --git a/eleventy.config.js b/eleventy.config.js index 886fa37..31f5ae0 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -28,7 +28,8 @@ export default async function(eleventyConfig) { // https://www.11ty.dev/docs/watch-serve/#add-your-own-watch-targets // Watch content images for the image pipeline. - eleventyConfig.addWatchTarget("content/**/*.{svg,webp,png,jpeg}"); + eleventyConfig.addWatchTarget("content/blog/**/*.md"); + eleventyConfig.addWatchTarget("content/blog/**/*.{svg,webp,png,jpeg}"); // Per-page bundles, see https://github.com/11ty/eleventy-plugin-bundle // Adds the {% css %} paired shortcode @@ -103,6 +104,55 @@ export default async function(eleventyConfig) { return (new Date()).toISOString(); }); + eleventyConfig.amendLibrary("md", (mdLib) => { + var defaultImageRender = mdLib.renderer.rules.image; + + mdLib.renderer.rules.image = function ( + tokens, + idx, + options, + env, + self + ) { + const token = tokens[idx]; + const aIndex = token.attrIndex("src"); + const link = token.attrs[aIndex][1]; + + if (/(http(s?)):\/\//i.test(link)) { + // Ignore + } else { + tokens[idx].attrs[aIndex][1] = env.page.url + link; + } + + return defaultImageRender(tokens, idx, options, env, self); + }; + + var defaultLinkOpenRender = mdLib.renderer.rules.link_open || function (tokens, idx, options, env, self) { + return self.renderToken(tokens, idx, options); + }; + + mdLib.renderer.rules.link_open = function ( + tokens, + idx, + options, + env, + self + ) { + const token = tokens[idx]; + const aIndex = token.attrIndex("href"); + const link = token.attrs[aIndex][1]; + + if (/(http(s?)):\/\//i.test(link)) { + // Ignore + } else { + tokens[idx].attrs[aIndex][1] = env.page.url + link; + } + + return defaultLinkOpenRender(tokens, idx, options, env, self); + }; + + }); + // Features to make your build faster (when you need them) // If your passthrough copy gets heavy and cumbersome, add this line diff --git a/public/css/index.css b/public/css/index.css index 1cfa083..d7f8b66 100644 --- a/public/css/index.css +++ b/public/css/index.css @@ -1,6 +1,6 @@ /* Defaults */ :root { - --font-family: -apple-system, system-ui, sans-serif; + --font-family: Roboto, -apple-system, system-ui, sans-serif; --font-family-monospace: Consolas, Menlo, Monaco, Andale Mono WT, Andale Mono, Lucida Console, Lucida Sans Typewriter, DejaVu Sans Mono, Bitstream Vera Sans Mono, Liberation Mono, Nimbus Mono L, Courier New, Courier, monospace; } @@ -57,7 +57,7 @@ html { overflow-y: scroll; } body { - max-width: 40em; + max-width: 60em; } /* https://www.a11yproject.com/posts/how-to-hide-content/ */ @@ -220,6 +220,7 @@ header { } .postlist-date { word-spacing: -0.5px; + flex-basis: 100%; } .postlist-link { font-size: 1.1875em; /* 19px /16 */