Home / Function/ extractCode() — supabase Function Reference

extractCode() — supabase Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  ec381ca3_a0ca_03ae_250e_63f4ece7f726["extractCode()"]
  816ab8fd_5aaa_f5ee_1dd8_0a70d0a7f3de["CodeBlock()"]
  816ab8fd_5aaa_f5ee_1dd8_0a70d0a7f3de -->|calls| ec381ca3_a0ca_03ae_250e_63f4ece7f726
  style ec381ca3_a0ca_03ae_250e_63f4ece7f726 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/docs/features/ui/CodeBlock/CodeBlock.tsx lines 151–162

function extractCode(children: React.ReactNode): string {
  if (typeof children === 'string') return children
  const child = Array.isArray(children) ? children[0] : children
  if (!!child && typeof child === 'object' && 'props' in child) {
    const props = child.props
    if (!!props && typeof props === 'object' && 'children' in props) {
      const code = props.children
      if (typeof code === 'string') return code
    }
  }
  return ''
}

Subdomains

Called By

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free