From 0bf83dfe67119316afa292818600b55e1a22967e Mon Sep 17 00:00:00 2001 From: Huang Xin Date: Tue, 19 Aug 2025 13:56:10 +0800 Subject: [PATCH] css: use monospace font for code blocks when overriding custom book fonts, closes #1805 (#1836) --- apps/readest-app/src/utils/style.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/apps/readest-app/src/utils/style.ts b/apps/readest-app/src/utils/style.ts index bb483cc3..c03e4c85 100644 --- a/apps/readest-app/src/utils/style.ts +++ b/apps/readest-app/src/utils/style.ts @@ -82,17 +82,16 @@ const getFontStyles = ( font[size="7"] { font-size: ${fontSize * 3}px; } - pre, code, kbd { - font-family: var(--monospace); - } /* hardcoded inline font size */ [style*="font-size: 16px"], [style*="font-size:16px"] { font-size: 1rem !important; } - body * { + pre, code, kbd { + font-family: var(--monospace); + } + body *:not(pre):not(code):not(kbd):not(pre *):not(code *):not(kbd *) { ${overrideFont ? 'font-family: revert !important;' : ''} } - `; return fontStyles; };