Bump script ver and refactor md metadata gen
Signed-off-by: Paul W. <lambdapaul@protonmail.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user