feat: enhance code viewer with modern Angular inputs and improved styling

- Updated CodeRendererComponent to use Angular's new input() signals instead of @Input decorators
- Added fallback content escaping for code that can't be syntax highlighted
- Improved code viewer styling with larger fonts, better padding and gradient header background
- Enhanced file content fetching with robust cache-busting and fallback mechanisms
- Added debug logging to track content loading and syntax highlighting
- Fixe
This commit is contained in:
2025-11-02 10:51:56 -05:00
parent 0dc346d6b7
commit 79e80fd798
4 changed files with 156 additions and 22 deletions
+61 -2
View File
@@ -77,6 +77,65 @@ console.log('hello world');
> citation
> avec plusieurs lignes
```javascript
console.log('hello world');
```python
"""Exemple de script Python illustrant l'usage des dataclasses."""
from dataclasses import dataclass, field
from datetime import datetime, timedelta
from typing import Iterable
@dataclass
class Task:
"""Représente une tâche planifiée avec une durée estimée."""
name: str
estimated_minutes: int
created_at: datetime = field(default_factory=datetime.now)
completed: bool = False
def remaining_minutes(self) -> int:
"""Calcule le temps restant estimé."""
return 0 if self.completed else self.estimated_minutes
def mark_done(self) -> None:
"""Marque la tâche comme terminée."""
self.completed = True
def summarize(tasks: Iterable[Task]) -> str:
"""Retourne un résumé textuel de la charge de travail."""
task_list = list(tasks)
total = sum(task.estimated_minutes for task in task_list)
remaining = sum(task.remaining_minutes() for task in task_list)
done = total - remaining
return (
f"Tâches: {len(task_list)}\n"
f"Terminé: {done} min\n"
f"Restant: {remaining} min\n"
f"Charge totale: {total} min"
)
def main() -> None:
"""Point d'entrée du script avec quelques exemples."""
tasks = [
Task("Préparer la réunion", estimated_minutes=45),
Task("Répondre aux emails", estimated_minutes=20),
Task("Prototyper l'interface", estimated_minutes=90),
]
# Marquer une tâche comme terminée pour illustrer la logique.
tasks[1].mark_done()
print("Résumé du jour:")
print(summarize(tasks))
# Afficher l'échéance approximative si toutes les tâches sont démarrées maintenant.
deadline = datetime.now() + timedelta(minutes=sum(task.remaining_minutes() for task in tasks))
print(f"Heure de fin estimée: {deadline:%H:%M}")
if __name__ == "__main__":
main()
```