all repos — kushiyaki @ 1dffdbb23a3ff9aaeef10771ff64a06b3b937df3

🍢 A tiny static site generator for grilling markdown files to perfection

deprecated/jsxEmbeder.js (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
import { markdownObj } from "./markdownObj";
import { unified } from "unified";
import rehypeFormat from "rehype-format";
import rehypeStringify from "rehype-stringify";
import baseline from "./input/baseline.jsx";
import { readFile } from "fs-extra";
import { extractContent } from "./deprecated/extractContent.js";
import rehypeParse from "rehype-parse";

const jsxProcessor = unified()
  .use(rehypeParse, { fragment: true })
  .use(rehypeFormat)
  .use(rehypeStringify);
//
//FIX seems to be an issue with the pipeline, run it and you'll see whats up
//
// const file = await markdownObj("./input/cookie.md");
const main = await extractContent("./input/cookie.md");
// console.log(file.main);
const output = await jsxProcessor.stringify(
  await jsxProcessor.run(
    baseline({
      // css: file.css,
      // header: eval(file.header)?.(file),
      // before: eval(file.before)?.(file),
      main: main,
      // after: eval(file.after)?.(file),
      // footer: eval(file.footer)?.(file),
    }),
  ),
);
console.log(output);