Home / Class/ MarkdownLoader Class — supabase Architecture

MarkdownLoader Class — supabase Architecture

Architecture documentation for the MarkdownLoader class in markdown.ts from the supabase codebase.

Entity Profile

Relationship Graph

Source Code

apps/docs/scripts/search/sources/markdown.ts lines 5–45

export class MarkdownLoader extends BaseLoader {
  type = 'markdown' as const

  constructor(
    source: string,
    public filePath: string,
    public options?: { yaml?: boolean }
  ) {
    const path = filePath.replace(/^(pages|content)/, '').replace(/\.mdx?$/, '')
    super(source, path)
  }

  async load() {
    const guide = (
      await GuideModelLoader.fromFs(this.filePath.replace(/^content\/guides/, ''))
    ).unwrap()
    return [
      new MarkdownSource(
        this.source,
        this.path,
        guide.content ?? '',
        {
          checksum: guide.checksum,
          meta: guide.metadata,
          sections: guide.subsections,
        },
        this.options
      ),
    ]
  }

  static fromGuideModel(source: string, guide: GuideModel): MarkdownSource {
    const path = guide.href ? guide.href.replace('https://supabase.com/docs', '') : ''

    return new MarkdownSource(source, path, guide.content ?? '', {
      checksum: guide.checksum,
      meta: guide.metadata,
      sections: guide.subsections,
    })
  }
}

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free