From aba5ef4bd287f929153bacadca28b5d2cd626c7a Mon Sep 17 00:00:00 2001 From: Nubenetes Bot Date: Fri, 22 May 2026 00:12:53 +0200 Subject: [PATCH] fix: exhaustive global sanitization to eliminate persistent MD039 linter errors - Implemented global data sanitization upon inventory load to strip whitespace and hidden characters from all titles. - Forced whitespace stripping during the initial Markdown extraction phase (V1 content gathering). - This ensures 100% clean link text across all rendered documentation, preventing 'Spaces inside link text' violations. --- src/v2_optimizer.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/v2_optimizer.py b/src/v2_optimizer.py index 88b0d24c..2de5ad25 100644 --- a/src/v2_optimizer.py +++ b/src/v2_optimizer.py @@ -82,6 +82,12 @@ class V2VisionEngine: async def analyze_and_cluster(self): log_event("STARTING V2 HIGH-DENSITY O'REILLY LIBRARY GENERATION", section_break=True) + + # Mandate 30: MD039 - Global Data Sanitization (Strip all titles to prevent linter errors) + for url in list(self.inventory.keys()): + if isinstance(self.inventory[url], dict) and "title" in self.inventory[url]: + self.inventory[url]["title"] = self.inventory[url]["title"].strip().strip("\u00a0\u200b") + # 0. Mandate Sync try: from src.mandate_ingestor import MandateIngestor @@ -158,7 +164,8 @@ class V2VisionEngine: title, url, full_desc = m.groups() if not url.startswith(("http", "mailto", "#")): url = f"https://nubenetes.com/{url.replace('.md', '/')}" - all_links.append({"title": title, "url": url, "description": full_desc.strip(), "original_file": file}) + # Mandate 30: MD039 - Strip all whitespace (including non-breaking space) from link text + all_links.append({"title": title.strip().strip("\u00a0\u200b"), "url": url.strip(), "description": full_desc.strip(), "original_file": file}) return all_links, mosaic_html, videos_html async def _verify_link_health(self, links: List[Dict]):