📦 À propos
+Authentification requise
+Connectez-vous pour accéder à ce fichier
+ +diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..0c39606 --- /dev/null +++ b/TODO.md @@ -0,0 +1,10 @@ +# Nouvelles fonctionnalités + - [ ] la détection et l'ajout de nouveaux fichiers dans l'interface se fait bien. Cependant, il faut que l'indexation se fasse automatiquement aussi pour les nouveaux fichiers. Optimiser l'indexation pour ne pas réindexer tout le contenu déjà indexé mais seulement les nouveaux fichiers. + - [ ] Dans le menu contextuel de l'arborescence, ajouter une option pour copier le path du répertoire courant ou du fichier courant dans le presse-papiers. + - [] Ajouter dans le menu de configuration une option pour visialiser un panneau a propos (About) permettant d'afficher des informations sur l'application ainsi que les versions des composants utilisés et la version de l'application. + - [ ] Dans le menu contextuel de l'arborescence sur n'importe quel voutes et dossiers, ajouter un bouton pour afficher un "graph view" en lien avec le path courant. Ce graph view doit afficher les relations entre les fichiers et les dossiers dans l'arborescence. Ce graph view doit être interactif et permettre de zoomer et de déplacer les nœuds comme dans celui de l'outils Obsidian. + - [ ] Ajouter le mode tab permettant de visualiser plusieurs fichiers à la fois dans l'interface. ajouter les fonctionnalités courantes de la gestion des tabs (fermer, déplacer, ajouter, etc.) incluant l'utilisation de raccourcis clavier pour les opérations de tab (simple clic vs double clic). + +# Corrections + - [ ] quand l'on ouvre un fichier via l'url popout, https://xxx/popout/path/du/fichier/fichier.md et qu'il y a un requis d'authentification (quand le message indique "Erreur lors du chargement (Essayez de vous reconnecter sur le site principal)") proposer un login et une fois login rediriger vers https://xxx/popout/path/du/fichier/fichier.md. + - [ ] Quand il y a une table des matières dans un fichier markdown, en clicant sur un titre de section, le scroll doit se déplacer automatiquement vers la section correspondante. Ca fonctionne avec certains liens mais pas sur d'autres. J'ai l'impression que le problème provient de lien avec des titre qui contient des lettres accentié. diff --git a/backend/indexer.py b/backend/indexer.py index b6814ff..89a8595 100644 --- a/backend/indexer.py +++ b/backend/indexer.py @@ -582,6 +582,30 @@ def _remove_file_from_structures(vault_name: str, rel_path: str) -> Optional[Dic return removed +def _ensure_parent_dirs_in_path_index(vault_name: str, rel_path: str, existing: set): + """Ensure all parent directories of a file path exist in path_index. + + For a path like ``a/b/c/file.md``, ensures ``a``, ``a/b``, and ``a/b/c`` + directory entries exist in path_index. + + Args: + vault_name: Name of the vault. + rel_path: Relative path of the file (e.g. ``a/b/c/file.md``). + existing: Set of paths already in path_index for this vault. + """ + parts = rel_path.split("/") + # Build parent directory paths + for i in range(1, len(parts)): + dir_path = "/".join(parts[:i]) + if dir_path and dir_path not in existing: + existing.add(dir_path) + path_index[vault_name].append({ + "path": dir_path, + "name": parts[i - 1], + "type": "directory", + }) + + def _add_file_to_structures(vault_name: str, file_info: Dict[str, Any]): """Add a file entry to all index structures. @@ -608,9 +632,8 @@ def _add_file_to_structures(vault_name: str, file_info: Dict[str, Any]): _file_lookup[key] = [] _file_lookup[key].append(entry) - # Add to path_index + # Add to path_index — also ensures parent directories are present if vault_name in path_index: - # Check if already present (avoid duplicates) existing = {p["path"] for p in path_index[vault_name]} if rel_path not in existing: path_index[vault_name].append({ @@ -618,6 +641,8 @@ def _add_file_to_structures(vault_name: str, file_info: Dict[str, Any]): "name": rel_path.rsplit("/", 1)[-1], "type": "file", }) + # Ensure all parent directories are in path_index + _ensure_parent_dirs_in_path_index(vault_name, rel_path, existing) _index_generation += 1 diff --git a/backend/main.py b/backend/main.py index cd7ac6c..c98a2c1 100644 --- a/backend/main.py +++ b/backend/main.py @@ -221,6 +221,30 @@ class TagSuggestResponse(BaseModel): suggestions: List[TagSuggestion] +class GraphNode(BaseModel): + """A single node in the graph view.""" + id: str = Field(description="Unique node identifier") + name: str = Field(description="Display name") + type: str = Field(description="'vault', 'directory', or 'file'") + path: str = Field(description="Relative path within vault") + size: int = Field(default=0, description="File size in bytes") + + +class GraphEdge(BaseModel): + """An edge between two nodes in the graph view.""" + source: str = Field(description="Source node ID") + target: str = Field(description="Target node ID") + relation: str = Field(description="'parent' or 'wikilink'") + + +class GraphResponse(BaseModel): + """Graph data for a vault or directory.""" + vault: str + path: str + nodes: List[GraphNode] + edges: List[GraphEdge] + + class ReloadResponse(BaseModel): """Index reload confirmation with per-vault stats.""" status: str @@ -595,6 +619,71 @@ def _check_vault_writable(vault_root: Path) -> bool: # Markdown rendering helpers (singleton renderer) # --------------------------------------------------------------------------- +import unicodedata + + +def _heading_slugify(text: str) -> str: + """Generate a URL-safe slug from heading text. + + Matches the JavaScript slugify algorithm exactly: + 1. Lowercase + 2. NFD normalize + strip combining marks + 3. Keep only Unicode letters, numbers, spaces, hyphens + 4. Replace spaces with hyphens, collapse multiple hyphens + + Args: + text: The heading text content. + + Returns: + A URL-safe slug string. + """ + text = text.lower() + text = unicodedata.normalize("NFD", text) + text = "".join(ch for ch in text if not unicodedata.combining(ch)) + # Keep only Unicode letters, numbers, spaces, and hyphens + cleaned = [] + for ch in text: + if ch.isalpha() or ch.isdigit() or ch in (" ", "-"): + cleaned.append(ch) + text = "".join(cleaned) + text = re.sub(r"\s+", "-", text) + text = re.sub(r"-+", "-", text) + return text.strip("-") or "heading" + + +def _add_heading_ids(html: str) -> str: + """Post-process rendered HTML to add IDs to heading tags. + + Adds an ``id`` attribute to every ``
Connectez-vous pour accéder à ce fichier
+ +