css: use monospace font for code blocks when overriding custom book fonts, closes #1805 (#1836)

This commit is contained in:
Huang Xin
2025-08-19 13:56:10 +08:00
committed by GitHub
parent b151b70cb9
commit 0bf83dfe67
+4 -5
View File
@@ -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;
};