Home / Class/ MarkdownSource Class — supabase Architecture

MarkdownSource Class — supabase Architecture

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

Entity Profile

Relationship Graph

Source Code

apps/docs/scripts/search/sources/markdown.ts lines 47–85

export class MarkdownSource extends BaseSource {
  type = 'markdown' as const

  constructor(
    source: string,
    path: string,
    public contents: string,
    {
      checksum,
      meta,
      sections,
    }: { checksum?: string; meta?: Record<string, unknown>; sections: Array<SubsectionModel> },
    public options?: { yaml?: boolean }
  ) {
    super(source, path)
    this.checksum = checksum
    this.meta = meta ?? {}
    this.sections = sections.map((section) => ({
      content: section.content ?? '',
      heading: section.title,
      slug: section.href,
    }))
  }

  async process() {
    return {
      checksum: this.checksum ?? '',
      meta: this.meta,
      sections: this.sections ?? [],
    }
  }

  extractIndexedContent(): string {
    const sections = this.sections ?? []
    const sectionText = sections.map(({ content }) => content).join('\n\n')

    return `# ${this.meta?.title ?? ''}\n\n${this.meta?.subtitle ?? ''}\n\n${sectionText}`
  }
}

Analyze Your Own Codebase

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

Try Supermodel Free