From 24b5dd033ac605006af677948d9e134e68b842af Mon Sep 17 00:00:00 2001 From: Bruno Charest Date: Mon, 14 Sep 2026 20:33:54 -0400 Subject: [PATCH] feat(viewer): couverture pretty print tous langages code (aliases hljs, langues hors bundle common, Dockerfile/Makefile) --- backend/main.py | 21 +++++++++++++++++++-- frontend/index.html | 11 +++++++++++ frontend/js/utils.js | 22 ++++++++++++++++++++++ frontend/js/viewer.js | 8 +++----- frontend/popout.html | 5 +++++ 5 files changed, 60 insertions(+), 7 deletions(-) diff --git a/backend/main.py b/backend/main.py index 89e9a32..379c088 100644 --- a/backend/main.py +++ b/backend/main.py @@ -1506,7 +1506,14 @@ EXT_TO_LANG = { ".cs": "csharp", ".go": "go", ".rs": "rust", ".rb": "ruby", ".php": "php", ".sql": "sql", ".r": "r", ".swift": "swift", ".kt": "kotlin", ".txt": "plaintext", ".log": "plaintext", - ".dockerfile": "dockerfile", ".makefile": "makefile", ".cmake": "cmake", + ".lua": "lua", ".pl": "perl", ".pm": "perl", ".ex": "elixir", ".exs": "elixir", + ".dart": "dart", ".tf": "haskell", ".gradle": "groovy", ".groovy": "groovy", + ".graphql": "graphql", ".gql": "graphql", ".prisma": "sql", ".proto": "c", + ".vb": "basic", ".asm": "x86asm", ".s": "armasm", + ".vue": "xml", ".svelte": "xml", ".astro": "xml", + ".properties": "ini", ".service": "ini", ".hosts": "ini", + ".ksh": "bash", ".dockerfile": "dockerfile", + ".makefile": "makefile", ".cmake": "cmake", } @@ -2500,7 +2507,17 @@ async def api_file(vault_name: str, path: str = Query(..., description="Relative } else: # Non-markdown: wrap in syntax-highlighted code block - lang = EXT_TO_LANG.get(ext, "plaintext") + lang = EXT_TO_LANG.get(ext, "") + if not lang: + # Fichiers sans extension usuels (Dockerfile, Makefile, etc.) + NAME_TO_LANG = { + "dockerfile": "dockerfile", "makefile": "makefile", + "cmakelists.txt": "cmake", "jenkinsfile": "groovy", + "vagrantfile": "ruby", "rakefile": "ruby", "gemfile": "ruby", + "procfile": "plaintext", "bashrc": "bash", "bash_profile": "bash", + "zshrc": "bash", "profile": "bash", "gitignore": "plaintext", + } + lang = NAME_TO_LANG.get(file_path.name.lower(), "plaintext") escaped = html_mod.escape(raw) html_content = f'
{escaped}
' diff --git a/frontend/index.html b/frontend/index.html index 7c5a8d7..ee0681b 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -88,6 +88,17 @@ /> + + + + + + + + + + + + + + + +