diff --git a/markdown_sqlite.py b/markdown_sqlite.py index 0ae8861..cefbf6d 100644 --- a/markdown_sqlite.py +++ b/markdown_sqlite.py @@ -9,6 +9,7 @@ reflects the current state of the markdown file. import os import sqlite3 +import uuid import hashlib import argparse import logging @@ -168,6 +169,7 @@ class MarkdownProcessor: ''', (document_id,)) for heading_id, level, title, parent_id, content in self.db_manager.cursor.fetchall(): structure[heading_id] = { + 'id': heading_id, # Add this line to include the id in each node 'level': level, 'title': title, 'parent_id': parent_id, @@ -175,13 +177,10 @@ class MarkdownProcessor: 'children': [] } # Build the tree structure - root = {} for id, node in structure.items(): if node['parent_id'] in structure: structure[node['parent_id']]['children'].append(id) - else: - root[id] = node - return root + return structure def parse_new_structure(self, tokens: List) -> Dict: structure = {}