From 279dfd620e6b46e2a89ed9e339a8e968ebf48e2f Mon Sep 17 00:00:00 2001 From: Nubenetes Bot Date: Thu, 21 May 2026 23:33:42 +0200 Subject: [PATCH] fix: optimize V2 UI (dark mode contrast, logic duplication, and functional deep-dives) - Fixed dark mode visibility by setting proper text and tag luminosities in docs/static/v2_elite.css. - Eliminated triple 'Explore Related' blocks by moving the injection outside recursion in src/v2_optimizer.py. - Fixed 'Technical Deep-Dive' rendering by correcting Markdown indentation for collapsible blocks. --- docs/static/v2_elite.css | 46 +++++++++++++++++++++++++++++++++++----- src/v2_optimizer.py | 19 ++++++++--------- 2 files changed, 50 insertions(+), 15 deletions(-) diff --git a/docs/static/v2_elite.css b/docs/static/v2_elite.css index e2bc9a06..24094fa0 100644 --- a/docs/static/v2_elite.css +++ b/docs/static/v2_elite.css @@ -18,12 +18,12 @@ [data-md-color-scheme="slate"] { /* DARK MODE - "Cyber Cloud" (Deep Space & Neon) */ - --md-primary-fg-color: #000000; /* Pure Black Base */ - --md-primary-fg-color--light: #09090b; /* Zinc 950 */ - --md-primary-fg-color--dark: #000000; + --md-primary-fg-color: #ffffff; /* Improved text contrast */ + --md-primary-fg-color--light: #e2e8f0; + --md-primary-fg-color--dark: #94a3b8; - --md-accent-fg-color: #06b6d4; /* Neon Cyan */ - --md-accent-fg-color--transparent: rgba(6, 182, 212, 0.15); + --md-accent-fg-color: #22d3ee; /* Brighter Neon Cyan */ + --md-accent-fg-color--transparent: rgba(34, 211, 238, 0.15); --md-default-bg-color: #09090b; /* Zinc 950 for main body */ --md-code-bg-color: #18181b; /* Zinc 900 for code blocks */ @@ -46,6 +46,42 @@ border-bottom: 1px solid rgba(255, 255, 255, 0.08); } +/* ---------------------------------------------------- */ +/* ENHANCED TAGS AND CHIPS */ +/* ---------------------------------------------------- */ + +.md-tag { + border-radius: 4px; + display: inline-block; + font-size: 0.65rem; + font-weight: 700; + line-height: 1.2; + padding: 0.2rem 0.4rem; + vertical-align: middle; + text-transform: uppercase; + letter-spacing: 0.025em; +} + +.md-tag--info { + background-color: rgba(14, 165, 233, 0.1); + color: #0284c7; +} + +[data-md-color-scheme="slate"] .md-tag--info { + background-color: rgba(56, 189, 248, 0.15); + color: #7dd3fc; /* Sky 300 for visibility */ +} + +.md-tag--success { + background-color: rgba(34, 197, 94, 0.1); + color: #16a34a; +} + +[data-md-color-scheme="slate"] .md-tag--success { + background-color: rgba(74, 222, 128, 0.15); + color: #86efac; /* Green 300 */ +} + /* ---------------------------------------------------- */ /* MICRO-ANIMATIONS & HOVER STATES */ /* ---------------------------------------------------- */ diff --git a/src/v2_optimizer.py b/src/v2_optimizer.py index 517e8dd5..400531ea 100644 --- a/src/v2_optimizer.py +++ b/src/v2_optimizer.py @@ -668,7 +668,7 @@ class V2VisionEngine: if "__links__" in node: for l in node["__links__"]: is_gold = is_intro and l.get("stars", 0) >= 4 - title = l['title'].replace("==", "") # Title from V1, often descriptive + title = l['title'].replace("==", "") if is_gold: img = f" ![Preview]({l.get('social_preview_url')})\n" if l.get('social_preview_url') else "" md += f"??? note \"{title}\"\n{img} **[Access Resource]({l['url']})** {'🌟'*l.get('stars',4)} | Level: {l.get('complexity', 'Beginner')}\n \n {l.get('ai_summary', l.get('description', ''))}\n\n" @@ -690,7 +690,6 @@ class V2VisionEngine: color = "success" if "STANDARD" in tag else "warning" if "EMERGING" in tag else "secondary" if "CASE STUDY" in tag or "GUIDE" in tag else "info" tag_html += f" {tag}" - # Apply Visual Highlighting based on stars raw_stars = l.get('stars', 0) link_content = title if raw_stars >= 5: @@ -703,15 +702,10 @@ class V2VisionEngine: # Layer 2: High-Density Technical Summary (Expandable Deep-Dive) summary = l.get('ai_summary', l.get('description', '')) if summary: - md += "\n ??? info \"Technical Deep-Dive\"\n" - # Indent the summary even further to be inside the details block - indented_summary = "\n".join([f" {line}" if line.strip() else "" for line in summary.strip().split("\n")]) + md += "\n ??? info \"Technical Deep-Dive\"\n" + # Standard 4-space indentation for blocks inside list items + indented_summary = "\n".join([f" {line}" if line.strip() else "" for line in summary.strip().split("\n")]) md += f"{indented_summary}\n\n" - - # Add Semantic "See Also" for related categories within the same Dimension - related = [f"[{data[f]['title']}](./{f})" for f in data if f != f_name and data[f]["dim"] == info["dim"]] - if related: - md += f"\n***\nšŸ’” **Explore Related:** {' | '.join(related[:3])}\n\n" return md for f_name, info in data.items(): @@ -722,6 +716,11 @@ class V2VisionEngine: md += await render_node(info["content"], -1, f_name.replace(".md", ""), is_intro=(f_name=="introduction.md")) + # Add Semantic "See Also" ONLY ONCE at the end of the page + related = [f"[{data[f]['title']}](./{f})" for f in data if f != f_name and data[f]["dim"] == info["dim"]] + if related: + md += f"\n***\nšŸ’” **Explore Related:** {' | '.join(related[:3])}\n\n" + # Smart Write: Only update disk if content changed target_path = os.path.join(V2_DIR, f_name) existing_content = ""