import { Blog, BlogHeader, Callout } from '@san-siva/blogkit'; import { readFile } from 'node:fs/promises'; import path from 'node:path'; import type { Thing, WithContext } from 'schema-dts'; import { parseMarkdown } from '../utils/parseMarkdown'; import { MarkdownSections, renderMarkdownAst } from '../utils/renderMarkdown'; type BlogPostProperties = { filePath: string; jsonLd?: WithContext; increasedWidthMode?: boolean; isTocEnabled?: boolean; }; const BlogPost = async ({ filePath, jsonLd, increasedWidthMode, isTocEnabled, }: BlogPostProperties) => { const absolutePath = path.isAbsolute(filePath) ? filePath : path.join(process.cwd(), filePath); let content: string; try { content = await readFile(absolutePath, 'utf8'); } catch { return (

Could not read file: "{filePath}". Make sure the path is correct and the file exists.

); } if (!content.trim()) { return ( File "{filePath}" is empty. ); } const { ast, title, description: desc } = parseMarkdown(content); const rendered = renderMarkdownAst(ast); return ( {title && } ); }; export default BlogPost;