Skip to content

Commit

Permalink
- Import parse_frontmatter utility in markdown source adapter
Browse files Browse the repository at this point in the history
- Update `parse_metadata` to be an async function
- Modify metadata extraction to support more flexible source adapter metadata retrieval
  • Loading branch information
Brian Joseph Petro committed Feb 25, 2025
1 parent e67c004 commit 586e190
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions smart-sources/adapters/markdown_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { FileSourceContentAdapter } from "./_file.js";
import { get_markdown_links } from "../utils/get_markdown_links.js";
import { parse_links } from "../content_parsers/parse_links.js";
import { parse_metadata } from "../content_parsers/parse_metadata.js";
import { parse_frontmatter } from "../utils/parse_frontmatter.js";
/**
* @class MarkdownSourceContentAdapter
* @extends FileSourceContentAdapter
Expand Down
6 changes: 3 additions & 3 deletions smart-sources/content_parsers/parse_metadata.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export function parse_metadata(source, content) {
export async function parse_metadata(source, content) {
if(!source.source_adapter?.get_metadata) return;
const {frontmatter} = source.source_adapter?.get_metadata?.(content);
source.data.metadata = frontmatter;
const metadata = await source.source_adapter?.get_metadata?.(content);
source.data.metadata = metadata;
}

0 comments on commit 586e190

Please sign in to comment.