Fixing mobile Korean typography and Rouge errors in Chirpy
Tune Jekyll Chirpy mobile typography for Korean text, clear Rouge .highlight .err false positives on Kotlin code, and add CJK monospace font fallbacks.
Jekyll Chirpy’s default mobile typography is tuned for Latin scripts, which makes Korean body text look oversized on phones. This post explains how I fixed mobile CJK typography, removed red Rouge
.highlight .errfalse positives on Kotlin code, and extended the monospace font stack insideassets/css/jekyll-theme-chirpy.scsswithout modifying any theme files.
Tested with Jekyll 4.4, jekyll-theme-chirpy 7.6, and Rouge.
The problem: oversized mobile Korean text and red Rouge tokens
Chirpy is designed around Latin typography. Because lowercase Latin letters have a relatively small x-height, Chirpy actually increases .content font size on mobile from 1.03rem (16.48px) on desktop to 1.08rem (17.28px) on small screens so English prose stays comfortable to read.
Korean glyphs behave differently. Each syllable block fills a full square em-box with dense strokes, so 17.28px Korean text looks noticeably larger than 17.28px English text. When I checked my blog on 375px to 390px phone viewports, three issues stacked up at once:
- Cramped line rhythm: Oversized body text reduced the number of words per line and broke scanning flow.
- Heavy heading and table density: Large
h1/h2titles and wide table cell padding forced extra vertical scrolling and horizontal overflow on comparison tables. - Red syntax-error boxes in valid code: Rouge flagged valid Kotlin use-site target annotations (
@field:NotNull,@get:JsonProperty) and non-ASCII backtick test method names with<span class="err">, painting bright red backgrounds right across code blocks.
Rather than forking Chirpy’s stylesheets, I fixed all three issues inside Chirpy’s official custom entry point, assets/css/jekyll-theme-chirpy.scss.
flowchart TD
A["jekyll-theme-chirpy.scss"] --> B["@use 'main' (theme bundle)"]
B --> C["Rouge .err reset & font stack"]
C --> D["Mobile (< 768px) typography"]
D --> E["Compressed Sass build"]
Tuning mobile (< 768px) typography for Korean readability
The fix for mobile Korean prose comes down to two numbers: bringing body copy down to 0.95rem (15.2px) and giving it generous breathing room with line-height: 1.72. Dense square glyphs need extra vertical spacing so your eye tracks cleanly from the end of one line to the start of the next.
| Element | Mobile value (< 768px) | Why it changed |
|---|---|---|
Post title (article header h1) | 1.5rem / line-height 1.35 | Prevents long titles from wrapping into four lines |
Body text (.content) | 0.95rem / line-height 1.72 | Reduces visual heaviness of square CJK glyphs |
Headings (h2 / h3 / h4) | 1.25rem / 1.1rem / 1rem | Preserves clear hierarchy relative to 0.95rem body |
Table cells (.table-wrapper > table) | 0.85rem / padding 0.35rem 0.75rem | Cuts unnecessary horizontal scrolling on phones |
Code blocks (.highlight pre) | 0.8rem | Keeps deeply indented code readable without wrapping |
Home card title (.card-title) | 1.1rem / line-height 1.4 | Balances feed density when scanning recent posts |
Here is the mobile media query I added to assets/css/jekyll-theme-chirpy.scss:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* assets/css/jekyll-theme-chirpy.scss */
/* =========================================================
* Mobile (< 768px) typography tuning for CJK readability
* (scales down Chirpy's Latin-first mobile defaults)
* ========================================================= */
@media (max-width: 767.98px) {
article header h1 {
font-size: 1.5rem;
line-height: 1.35;
}
.content {
font-size: 0.95rem;
line-height: 1.72;
h2 {
font-size: 1.25rem;
line-height: 1.35;
}
h3 {
font-size: 1.1rem;
line-height: 1.4;
}
h4 {
font-size: 1rem;
}
}
.table-wrapper > table {
thead th,
tbody tr td {
font-size: 0.85rem;
padding: 0.35rem 0.75rem;
}
}
.highlight pre,
code.highlighter-rouge {
font-size: 0.8rem;
}
#post-list .card-wrapper .card-title {
font-size: 1.1rem;
line-height: 1.4;
}
}
If your site is strictly English-only, you don’t need to shrink .content below Chirpy’s 1.08rem default. Even on bilingual sites, though, 0.95rem with 1.72 line height stays comfortable for English paragraphs while making Korean posts dramatically easier to scan.
Clearing Rouge .highlight .err boxes and extending the coding font stack
Jekyll highlights fenced code blocks through Kramdown and Rouge. Whenever a Rouge lexer encounters a token it doesn’t recognize, it wraps that token in <span class="err">. Chirpy’s default syntax theme styles .highlight .err with a bright red background.
In practice, Rouge’s Kotlin lexer often misclassifies valid Kotlin syntax—such as @field:NotNull, @get:JsonProperty, or JUnit test functions named with backtick-quoted Korean phrases. Fixing the lexer upstream is slow, while neutralizing .highlight .err in CSS removes the visual noise immediately without hiding any code.
At the same time, I extended the monospace font-family stack. Without CJK fallbacks after Latin monospace fonts, Windows browsers fall back to legacy bitmap-style Gulim fonts inside code comments. Listing Pretendard, D2Coding, Nanum Gothic Coding, Apple SD Gothic Neo, and Malgun Gothic after the standard Latin monospace fonts keeps comments crisp across macOS and Windows.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* assets/css/jekyll-theme-chirpy.scss */
/* Remove red background on Rouge lexer false positives (.err) */
.highlight .err {
color: inherit !important;
background-color: transparent !important;
}
/* Extend code font stack with local coding fonts and OS CJK fallbacks */
pre,
code,
kbd,
samp {
font-family:
SFMono-Regular,
Menlo,
Monaco,
Consolas,
'Liberation Mono',
'Courier New',
'Pretendard Variable',
Pretendard,
'D2Coding',
'Nanum Gothic Coding',
'Apple SD Gothic Neo',
'Malgun Gothic',
monospace !important;
}
Because browsers perform per-glyph font matching, ASCII characters, brackets, and operators still render in SFMono-Regular, Menlo, or Consolas. Only CJK glyphs that are missing from the Latin monospace font fall through to Pretendard, D2Coding, or the OS default sans-serif.
Caveats when overriding Chirpy SCSS
1. Keep the @use 'main' header and Liquid branch intact
Chirpy 7.x compiles styles with Dart Sass and places a conditional @use block at the very top of assets/css/jekyll-theme-chirpy.scss:
1
2
3
4
5
6
7
8
9
10
---
---
@use 'main
{%- if jekyll.environment == 'production' -%}
.bundle
{%- endif -%}
';
/* append your custom style below */
Warning: Placing any CSS rule above
@usebreaks Dart Sass compilation, and deleting the Liquid conditional drops Chirpy’s production bundle optimization. Always keep the top eight lines untouched and append custom rules below them.
2. Scope !important narrowly and respect dark mode
Only use !important where Chirpy’s compiled selectors have higher specificity—here, .highlight .err and pre, code. Leave it off the mobile typography rules so future overrides stay predictable. Also avoid hardcoded hex colors; using inherit or Chirpy’s CSS custom properties ensures both light and dark themes remain legible.
3. Don’t load multi-megabyte CJK webfonts just for code comments
Pulling a full Korean webfont from an external CDN solely to style comments inside <pre> blocks hurts mobile Largest Contentful Paint (LCP) and burns bandwidth. Relying on locally installed developer fonts (Pretendard, D2Coding) plus OS defaults (Apple SD Gothic Neo, Malgun Gothic) costs zero network bytes.
Verification checklist
After editing assets/css/jekyll-theme-chirpy.scss, verify these four items before deploying:
- Open a Kotlin post with
@field:annotations or non-ASCII backtick identifiers and confirm no red.errboxes appear. - Switch between light and dark modes in the sidebar to make sure
.highlight .errtext inherits readable foreground colors. - Emulate a
390pxmobile viewport in Chrome DevTools and check body text rhythm, heading hierarchy, and table padding. - Run a production Jekyll build (
JEKYLL_ENV=production bundle exec jekyll build) to confirm Dart Sass compiles cleanly with the.bundlebranch.
For more details on how Jekyll compiles Sass files, see the official Jekyll assets guide.