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.
This commit is contained in:
Nubenetes Bot
2026-05-21 23:33:42 +02:00
parent 7a70f54fcb
commit 279dfd620e
2 changed files with 50 additions and 15 deletions

View File

@@ -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" <span class='md-tag md-tag--{color}'>{tag}</span>"
# 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 = ""