remark plugin to compile markdown to pdf.
MIT License
remark plugin to compile markdown to pdf.
This project is aiming to support all nodes in mdast syntax tree, but currently transformation and stylings may not be well.
If you have some feature requests or improvements, please create a issue or PR.
https://inokawa.github.io/remark-pdf/
npm install remark-pdf
import { unified } from "unified";
import markdown from "remark-parse";
import pdf from "remark-pdf";
import { saveAs } from "file-saver";
const processor = unified().use(markdown).use(pdf, { output: "blob" });
const text = "# hello world";
(async () => {
const doc = await processor.process(text);
const blob = await doc.result;
saveAs(blob, "example.pdf");
})();
import { unified } from "unified";
import markdown from "remark-parse";
import pdf from "remark-pdf/node";
import * as fs from "fs";
const processor = unified().use(markdown).use(pdf, { output: "buffer" });
const text = "# hello world";
(async () => {
const doc = await processor.process(text);
const buffer = await doc.result;
fs.writeFileSync("example.pdf", buffer);
})();
All contributions are welcome. If you find a problem, feel free to create an issue or a PR.
npm install
.