Files
supabase/apps/docs/resources/guide/guideModel.ts
Charis e46ab9c1a2 refactor: reading markdown docs files (#37774)
* refactor: reading markdown docs files

Refactor how Markdown docs files are read:
- Reuses the same logic across search index generation & page generation
- Improves the indexed content for search:
  - Stops removing MDX components, which often contain useful
    information like Admonitions
  - Denormalizes Partials and CodeSamples for more complete content

This is a prerequisite step for implementing the "Copy docs as Markdown"
functionality.

Only touches regular guides for now, not federated ones.

* fix: tailwind build error (#37728)

We changed to default to ESM imports a while ago, which means local
builds are now breaking because the Tailwind uses a require. Changed to
CJS for Tailwind config file. (I have no idea how this has been working
on Vercel all this time.)

* style: prettier
2025-08-13 11:37:14 -04:00

46 lines
1.1 KiB
TypeScript

import { type SearchResultInterface } from '../globalSearch/globalSearchInterface'
export class GuideModel implements SearchResultInterface {
public title?: string
public href?: string
public checksum?: string
public content?: string
public metadata?: Record<string, unknown>
public subsections: Array<SubsectionModel>
constructor({
title,
href,
checksum,
content,
metadata,
subsections,
}: {
title?: string
href?: string
checksum?: string
content?: string
metadata?: Record<string, unknown>
subsections?: Array<{ title?: string; href?: string; content?: string }>
}) {
this.title = title
this.href = href
this.checksum = checksum
this.content = content
this.metadata = metadata
this.subsections = subsections?.map((subsection) => new SubsectionModel(subsection)) ?? []
}
}
export class SubsectionModel {
public title?: string
public href?: string
public content?: string
constructor({ title, href, content }: { title?: string; href?: string; content?: string }) {
this.title = title
this.href = href
this.content = content
}
}