From 59be8fc4c3f589fba74706d37fdc8654c4f0849f Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Mon, 18 Mar 2024 23:39:12 -0400 Subject: [PATCH] Better-delimited styling of code fragments in article text Non-fenced code fragments (using backticks in Markdown) will now be formatted with a background color, padding, and a border. I was avoiding this for some time, but most of my writing also didn't have a whole lot of code in it. That's changing with the article I'm writing now, and it really is much more clear with this styling; it can otherwise be more difficult than necessary to tell where a command starts and ends, and the monospace font can sometimes be too sublte of an indicator for shorter text, or text that uses characters that are harder to distinguish. --- style.css | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/style.css b/style.css index a61e220..212baf4 100644 --- a/style.css +++ b/style.css @@ -512,6 +512,14 @@ article img { margin: 0 auto; } +/* Non-fenced code (e.g. backticks) */ +article code:not(.sourceCode) { + background-color: #f8f8f8; /* matches pandoc */ + border: 1px solid rgba(0, 0, 0, 0.15); + border-radius: 0.25em; + padding: 0.15ex 0.15em; +} + /* Two columns on larger displays */ @media ( min-width: 90ch ) {