From 7bffcd25397086baf52e238411b190733e214038 Mon Sep 17 00:00:00 2001 From: Xevion Date: Sun, 26 Nov 2023 10:24:55 -0600 Subject: [PATCH] Add shiki to config, set theme & tune theme bg with CSS --- astro.config.mjs | 13 +++++++++++++ src/styles/code.scss | 7 +++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/astro.config.mjs b/astro.config.mjs index 9f48763..3c012ca 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -5,4 +5,17 @@ import tailwind from "@astrojs/tailwind"; // https://astro.build/config export default defineConfig({ integrations: [tailwind()], + markdown: { + shikiConfig: { + // Choose from Shiki's built-in themes (or add your own) + // https://github.com/shikijs/shiki/blob/main/docs/themes.md + theme: 'github-dark', + // Add custom languages + // Note: Shiki has countless langs built-in, including .astro! + // https://github.com/shikijs/shiki/blob/main/docs/languages.md + langs: [], + // Enable word wrap to prevent horizontal scrolling + wrap: true, + }, + }, }); diff --git a/src/styles/code.scss b/src/styles/code.scss index 7f75199..5ac39f8 100644 --- a/src/styles/code.scss +++ b/src/styles/code.scss @@ -2,7 +2,6 @@ pre, code { font-family: "CMU Typewriter Text", monospace; font-size: 0.8em; - font-style: normal !important; } // Inline code styling @@ -29,8 +28,12 @@ a > code { pre { background: rgb(25, 25, 25); - border-radius: 7px; + border-radius: 5px; padding: 1em; + + &.astro-code { + background-color: #191919 !important; + } code { font-size: 1em;