Handle file names appropriately for md files and render commits in github results

This commit is contained in:
sabaimran 2023-07-01 01:20:58 -07:00
parent dbe713604d
commit dac2d14380
2 changed files with 5 additions and 3 deletions

View file

@ -70,7 +70,8 @@
} else if (
item.additional.file.endsWith(".md") ||
item.additional.file.endsWith(".markdown") ||
(item.additional.file.includes("issues") && item.additional.file.includes("github.com"))
(item.additional.file.includes("issues") && item.additional.file.includes("github.com")) ||
(item.additional.file.includes("commit") && item.additional.file.includes("github.com"))
)
{
html += render_markdown(query, [item]);

View file

@ -147,12 +147,13 @@ class MarkdownToJsonl(TextToJsonl):
if type(raw_filename) == str and re.search(r"^https?://", raw_filename):
entry_filename = raw_filename
else:
entry_filename = Path(raw_filename)
entry_filename = str(Path(raw_filename))
stem = Path(raw_filename).stem
heading = parsed_entry.splitlines()[0] if re.search("^#+\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.stem}\n#" if heading else f"# {entry_filename.stem}\n"
prefix = f"# {stem}\n#" if heading else f"# {stem}\n"
compiled_entry = f"{prefix}{parsed_entry}"
entries.append(
Entry(