From 237fae111ac686629bdb31aaac50dc4950dba5d1 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 19 May 2026 06:11:40 +0000 Subject: [PATCH] Add per-category line-height support Nastaliq and other complex scripts need significantly more vertical space than Latin text. A new `line-height` key on any category entry in config.yml overrides --line-height-body for that category and restores the theme default when switching away. https://claude.ai/code/session_01LZVnq4wUgdv5oXFLcj6qXf --- CLAUDE.md | 1 + app/index.html | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CLAUDE.md b/CLAUDE.md index 17f288f..50c27bc 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -166,6 +166,7 @@ For nested navigation, set `parent: ` and `parent-sort` on - Variant files: `..md` — the suffix is only treated as a category if the code is declared in config - `categories-sectionnames: per-category` requires each section in `nav.yml` to have a `categorynames` block with an entry per category code - RTL is set per category via `direction: rtl` +- Line height is set per category via `line-height: 2.8` (useful for scripts like Nastaliq that need extra vertical space). Restores to theme default when switching to a category without this key. ## Dynamic post tags (mdcms code blocks) diff --git a/app/index.html b/app/index.html index b9b030a..10b73de 100644 --- a/app/index.html +++ b/app/index.html @@ -957,6 +957,7 @@ body { let activeCategory = null; // current code let sectionnamesMode = 'same'; // 'same' | 'per-category' let loadedFonts = new Set(); // track which font files have been loaded + let defaultLineHeight = null; // theme/CSS default, captured after theme is applied // ─── Icons ──────────────────────────────────────────────── const STANDARD_ICONS = ['dark_mode','light_mode','menu','search','arrow_right','arrow_drop_down','mobile_arrow_down','language','info','warning','error','success','exclamation','dangerous','report','history','text_compare','keyboard_arrow_right','keyboard_arrow_down','keyboard_double_arrow_right','keyboard_double_arrow_down','expand_content','collapse_content','add','minimize']; @@ -2298,6 +2299,9 @@ function fmtDatetime(dtStr) { document.querySelectorAll('.category-bar').forEach(b => b.setAttribute('dir', direction)); document.querySelectorAll('.md-content, .title-bar').forEach(el => el.setAttribute('dir', direction)); document.querySelectorAll('.sidebar').forEach(el => el.setAttribute('dir', direction)); + // Apply per-category line-height override, or restore theme default + const lh = cat && cat['line-height']; + document.documentElement.style.setProperty('--line-height-body', lh ? String(lh) : (defaultLineHeight || '1.7')); } function doSearch(query, resultsEl) { @@ -2770,6 +2774,7 @@ function fmtDatetime(dtStr) { if (config.theme) applyThemeYml(themeConfig); else applyConfigTheme(); + defaultLineHeight = getComputedStyle(document.documentElement).getPropertyValue('--line-height-body').trim() || '1.7'; applyTheme(getInitialTheme()); // nav.yml — phase 2 expects `sections:` + `pages:` blocks; phase 1 flat