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.
Mike Gerwitz 2024-03-18 23:39:12 -04:00
parent 8448669355
commit 59be8fc4c3
Signed by: mikegerwitz
GPG Key ID: 8C917B7F5DC51BA2
1 changed files with 8 additions and 0 deletions

View File

@ -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 ) {