From 1820dd34fcb91ab8c91cecd5726acf0a5d569a0a Mon Sep 17 00:00:00 2001 From: Bryce Huhtala <100382978+sketchius@users.noreply.github.com> Date: Wed, 22 Jan 2025 20:09:23 -0500 Subject: [PATCH] UX: Revert #30547 UX: use em units for code font-size (#30936) The solution in (https://github.com/discourse/discourse/pull/30547) using `em` units was causing readability problems for code blocks in mobile. This reverts to the previous solution (https://github.com/discourse/discourse/pull/30536) of using `font-size: inherit` for code within heading elements. The downside is that the code in heading won't be slightly smaller than the other text like it is for inline code in paragraphs, but it seems worth it to avoid causing other size issues. --- .../stylesheets/common/base/code_highlighting.scss | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/common/base/code_highlighting.scss b/app/assets/stylesheets/common/base/code_highlighting.scss index 1cd6d077a14..0b8e75f8ab5 100644 --- a/app/assets/stylesheets/common/base/code_highlighting.scss +++ b/app/assets/stylesheets/common/base/code_highlighting.scss @@ -19,7 +19,7 @@ code { color: var(--primary-very-high); background: var(--hljs-bg); border-radius: var(--d-border-radius); - font-size: 0.875em; + font-size: 14px; line-height: calc((13 + 4) / 13); } @@ -29,6 +29,15 @@ pre > code { max-height: 500px; } +h1 code, +h2 code, +h3 code, +h4 code, +h5 code, +h6 code { + font-size: inherit; +} + .hljs-comment, .hljs-doctag, .hljs-code,