Class MarkdownImporter

Imports Markdown files from a directory into a SqliteBrain.

Usage:

const importer = new MarkdownImporter(brain);
const result = await importer.import('/path/to/vault');
console.log(result.imported, result.skipped);

Hierarchy (view full)

Constructors

Methods

Properties

Constructors

Methods

  • Recursively walk sourceDir, parse every .md file, and insert traces.

    Non-Markdown files are silently ignored. Files that fail to parse are recorded in result.errors and processing continues.

    Parameters

    • sourceDir: string

      Directory to recursively scan for .md files.

    • Optional options: Pick<ImportOptions, "dedup">

    Returns Promise<ImportResult>

    ImportResult with counts of imported, skipped, and errored items.

  • Post-process a parsed file before it is inserted into the database.

    The base implementation is a no-op. ObsidianImporter overrides this to extract [[wikilinks]] and #tags.

    Parameters

    • _filePath: string

      Absolute path of the source file.

    • _frontmatter: TraceFrontmatter

      Parsed front-matter data.

    • _body: string

      Markdown body content.

    • _result: ImportResult

      Mutable result accumulator.

    • _traceId: string

      The ID assigned (or taken from front-matter) for this trace.

    Returns Promise<void>

Properties

The target SqliteBrain to import into.