* Formats a section string by replacing hyphens with spaces and capitalizing the first letter of each word. * * @param section - The section string to format. * @returns The formatted section string.
(section)
| 14 | * @returns The formatted section string. |
| 15 | */ |
| 16 | async function formatString(section) { |
| 17 | if (!section) return ''; |
| 18 | return section |
| 19 | .replace(/-/g, ' ') |
| 20 | .replace(/\b\w/g, char => char.toUpperCase()); |
| 21 | } |
| 22 | |
| 23 | async function fetchMDXContent({ slug, section, dirPath, baseUrl }) { |
| 24 | const { serialize } = await import('next-mdx-remote/serialize'); |