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
This commit is contained in:
Debanjum Singh Solanky 2024-07-06 19:05:55 +05:30
parent 010486fb36
commit 1baebb8d0e

View file

@ -146,7 +146,7 @@ class MarkdownToEntries(TextToEntries):
else: else:
entry_filename = str(Path(raw_filename)) 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 # Append base filename to compiled entry for context to model
# Increment heading level for heading entries and make filename as its top level heading # 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" prefix = f"# {entry_filename}\n#" if heading else f"# {entry_filename}\n"