module ui import os // Recursive menu renderer pub fn menu_html(items []MenuItem, depth int, prefix string) string { mut out := []string{} for i, it in items { id := '${prefix}_${depth}_${i}' if it.children.len > 0 { // expandable group out << '
' out << '' out << '${it.title}' out << '' out << '
' out << '
' out << menu_html(it.children, depth + 1, id) out << '
' out << '
' out << '
' } else { // leaf out << '${it.title}' } } return out.join('\n') } // Language detection utility for code files pub fn detect_lang(path string) string { ext := os.file_ext(path).trim_left('.') return match ext.to_lower() { 'v' { 'v' } 'js' { 'javascript' } 'ts' { 'typescript' } 'py' { 'python' } 'rs' { 'rust' } 'go' { 'go' } 'java' { 'java' } 'c', 'h' { 'c' } 'cpp', 'hpp', 'cc', 'hh' { 'cpp' } 'sh', 'bash' { 'bash' } 'json' { 'json' } 'yaml', 'yml' { 'yaml' } 'html', 'htm' { 'html' } 'css' { 'css' } 'md' { 'markdown' } else { 'text' } } }