Home / Function/ generateRefMarkdown() — supabase Function Reference

generateRefMarkdown() — supabase Function Reference

Architecture documentation for the generateRefMarkdown() function in generateRefMarkdown.tsx from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  38e0081e_cb95_02ee_2464_0872746e3eec["generateRefMarkdown()"]
  b0f0efc1_128f_b641_ce58_a810aa965352["handleRefStaticProps()"]
  b0f0efc1_128f_b641_ce58_a810aa965352 -->|calls| 38e0081e_cb95_02ee_2464_0872746e3eec
  style 38e0081e_cb95_02ee_2464_0872746e3eec fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/docs/lib/mdx/generateRefMarkdown.tsx lines 9–57

async function generateRefMarkdown(sections: ICommonMarkdown[], slug: string) {
  let markdownContent: any[] = []
  /**
   * Read all the markdown files that might have
   *  - custom text
   *  - call outs
   *  - important notes regarding implementation
   */
  await Promise.all(
    sections.map(async (section) => {
      const pathName = `docs/ref${slug}/${section.id}.mdx`

      function checkFileExists(x) {
        if (fs.existsSync(x)) {
          return true
        } else {
          return false
        }
      }

      const markdownExists = checkFileExists(pathName)

      if (!markdownExists) return null

      const fileContents = markdownExists ? fs.readFileSync(pathName, 'utf8') : ''
      const { data, content } = matter(fileContents)

      markdownContent.push({
        id: section.id,
        title: section.title,
        meta: data,
        // introPage: introPages.includes(x),
        content: content
          ? await serialize(content ?? '', {
              // MDX's available options, see the MDX docs for more info.
              // https://mdxjs.com/packages/mdx/#compilefile-options
              mdxOptions: {
                useDynamicImport: true,
                remarkPlugins: [remarkGfm],
              },
              // Indicates whether or not to parse the frontmatter from the mdx source
            })
          : null,
      })
    })
  )

  return markdownContent
}

Subdomains

Frequently Asked Questions

What does generateRefMarkdown() do?
generateRefMarkdown() is a function in the supabase codebase.
What calls generateRefMarkdown()?
generateRefMarkdown() is called by 1 function(s): handleRefStaticProps.

Analyze Your Own Codebase

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

Try Supermodel Free