Home / Function/ extractLang() — supabase Function Reference

extractLang() — supabase Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  de3be49a_2a73_b17d_6194_ac4320ac077d["extractLang()"]
  816ab8fd_5aaa_f5ee_1dd8_0a70d0a7f3de["CodeBlock()"]
  816ab8fd_5aaa_f5ee_1dd8_0a70d0a7f3de -->|calls| de3be49a_2a73_b17d_6194_ac4320ac077d
  845600f7_3dab_ff30_03be_154874a8bf7e["tryToBundledLanguage()"]
  de3be49a_2a73_b17d_6194_ac4320ac077d -->|calls| 845600f7_3dab_ff30_03be_154874a8bf7e
  style de3be49a_2a73_b17d_6194_ac4320ac077d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/docs/features/ui/CodeBlock/CodeBlock.tsx lines 164–178

function extractLang(children: React.ReactNode): BundledLanguage | null {
  if (typeof children === 'string') return null
  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' && 'className' in props) {
      const className = props.className
      if (typeof className === 'string') {
        const lang = className.split(' ').find((className) => className.startsWith('language-'))
        return lang ? tryToBundledLanguage(lang.replace('language-', '')) : null
      }
    }
  }
  return null
}

Subdomains

Called By

Frequently Asked Questions

What does extractLang() do?
extractLang() is a function in the supabase codebase.
What does extractLang() call?
extractLang() calls 1 function(s): tryToBundledLanguage.
What calls extractLang()?
extractLang() 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