Bump script ver and refactor md metadata gen

Signed-off-by: Paul W. <lambdapaul@protonmail.com>
This commit is contained in:
2023-10-30 00:18:38 -04:00
parent 2bc72ce3e9
commit e470224031
38 changed files with 412 additions and 8679 deletions
+9
View File
@@ -0,0 +1,9 @@
import { readFile } from 'fs/promises';
import path from 'path';
export default async function readMarkdown(directory: string, slug: string, withoutTitle: boolean = false): Promise<string> {
const content = await readFile(path.join(process.cwd(), directory, `${slug}.md`), 'utf-8');
if (withoutTitle)
return content.substring(content.indexOf('\n') + 1, content.length);
return content;
}