From 72bd31b626e37fa64864c327afcf08b62f44842e Mon Sep 17 00:00:00 2001 From: Joakim Date: Thu, 11 Sep 2025 17:38:15 +0200 Subject: [PATCH] feat: implement collision-free lightweight hierarchical ID generation - Replace content-hash based ID generation with position-based algorithm - Use file + element identity + position index + hash for unique IDs - Generate human-readable prefixes (e.g. index-lead-, index-p-2-) - Add collision-resistant hash suffixes for guaranteed uniqueness - Update Generate() to accept filePath parameter for context - Fix ID collisions where hero and footer elements shared same ID - Clean demo site files removing all data-content-id attributes - Preserve insertr-gate elements for authentication functionality Results: Hero gets 'index-lead-2-fc31f2', footer gets 'index-p-13-99fd13' No more content cross-contamination between different elements. --- demo-site/about.html | 32 ++--- demo-site/index.html | 38 +++--- internal/api/handlers.go | 3 +- internal/parser/id_generator.go | 224 ++++++++++++++------------------ internal/parser/parser.go | 2 +- 5 files changed, 132 insertions(+), 167 deletions(-) diff --git a/demo-site/about.html b/demo-site/about.html index 3ec8475..4b4601c 100644 --- a/demo-site/about.html +++ b/demo-site/about.html @@ -9,7 +9,7 @@