feat: add posts

This commit is contained in:
Andrea
2023-03-01 20:39:41 +01:00
parent 18e1c1e2e6
commit 806ef1ec90
18 changed files with 3810 additions and 858 deletions

26
app/utils/posts.server.ts Normal file
View File

@@ -0,0 +1,26 @@
import { remarkCodeHike } from "@code-hike/mdx";
import { readFile } from "fs/promises";
import { bundleMDX } from "mdx-bundler";
import codeHikeTheme from "shiki/themes/one-dark-pro.json";
export const getMdxFile = async (path: string) => {
const source = await readFile(path);
return bundleMDX({
source: source.toString(),
mdxOptions() {
return {
remarkPlugins: [
[
remarkCodeHike,
{
theme: codeHikeTheme,
lineNumbers: true,
showCopyButton: true,
autoImport: true,
},
],
],
};
},
});
};