From 1baebb8d0e837014671e0f007359a91c3a1c17c2 Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Sat, 6 Jul 2024 19:05:55 +0530 Subject: [PATCH] Identify markdown headings by any whitespace character after ^#+ Previously only markdown headings with space characters after # would be considered a heading. So ^##\t wouldn't be considered a valid heading --- src/khoj/processor/content/markdown/markdown_to_entries.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/khoj/processor/content/markdown/markdown_to_entries.py b/src/khoj/processor/content/markdown/markdown_to_entries.py index ae0bd822..f18e1e21 100644 --- a/src/khoj/processor/content/markdown/markdown_to_entries.py +++ b/src/khoj/processor/content/markdown/markdown_to_entries.py @@ -146,7 +146,7 @@ class MarkdownToEntries(TextToEntries): else: entry_filename = str(Path(raw_filename)) - heading = parsed_entry.splitlines()[0] if re.search("^#+\s", parsed_entry) else "" + heading = parsed_entry.splitlines()[0] if re.search(r"^#+\s", parsed_entry) else "" # Append base filename to compiled entry for context to model # Increment heading level for heading entries and make filename as its top level heading prefix = f"# {entry_filename}\n#" if heading else f"# {entry_filename}\n"