processMdx() — supabase Function Reference
Architecture documentation for the processMdx() function in last-changed.ts from the supabase codebase.
Entity Profile
Dependency Diagram
graph TD c6ba9fcb_19c2_0847_332c_187b52d1c2d6["processMdx()"] c4ba6037_4ea4_e34c_3bed_9d9cf63274e8["updateTimestamps()"] c4ba6037_4ea4_e34c_3bed_9d9cf63274e8 -->|calls| c6ba9fcb_19c2_0847_332c_187b52d1c2d6 7920f0ed_264a_f954_6f8a_ec73ded46618["processMdx()"] c6ba9fcb_19c2_0847_332c_187b52d1c2d6 -->|calls| 7920f0ed_264a_f954_6f8a_ec73ded46618 ba597464_635f_07d6_76dd_3978e7d83745["createHash()"] c6ba9fcb_19c2_0847_332c_187b52d1c2d6 -->|calls| ba597464_635f_07d6_76dd_3978e7d83745 style c6ba9fcb_19c2_0847_332c_187b52d1c2d6 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
apps/docs/scripts/last-changed.ts lines 166–209
function processMdx(rawContent: string): Array<SectionWithChecksum> {
let content: string
try {
content = matter(rawContent).content
} catch (err) {
content = matter(rawContent, {
language: 'toml',
engines: { toml: parse },
}).content
}
const GLOBAL_HEADING_REGEX = /(?:^|\n)(?=#+\s+[^\n]+[\n$])/g
const sections = content.split(GLOBAL_HEADING_REGEX)
const seenHeadings = new Map<string, number>()
const HEADING_MATCH_REGEX = /^#+\s+([^\n]+)[\n$]/
const result: Array<SectionWithChecksum> = sections.map((section) => {
const rawHeading = section.match(HEADING_MATCH_REGEX)?.[1] ?? '[EMPTY]'
let heading = rawHeading
if (seenHeadings.has(rawHeading)) {
const idx = (seenHeadings.get(rawHeading) ?? 0) + 1
seenHeadings.set(rawHeading, idx)
heading = `${rawHeading} (__UNIQUE_MARKER__${idx})`
} else {
seenHeadings.set(rawHeading, 1)
}
const normalizedSection = section
.trim()
.replace(/[\n\t]/g, ' ')
.replace(/\s+/g, ' ')
const checksum = createHash('sha256').update(normalizedSection).digest('base64')
return {
heading,
content: normalizedSection,
checksum,
}
})
return result
}
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does processMdx() do?
processMdx() is a function in the supabase codebase.
What does processMdx() call?
processMdx() calls 2 function(s): createHash, processMdx.
What calls processMdx()?
processMdx() is called by 1 function(s): updateTimestamps.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free