0.0.13 • Published 9 months ago

remark-pdf v0.0.13

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

remark-pdf

npm check demo

remark plugin to compile markdown to pdf.

🚧 WIP 🚧

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.

  • paragraph
  • heading
  • thematicBreak
  • blockquote
  • list
  • listItem
  • table
  • tableRow
  • tableCell
  • html
  • code
  • yaml
  • toml
  • definition
  • footnoteDefinition
  • text
  • emphasis
  • strong
  • delete
  • inlineCode
  • break
  • link
  • image
  • linkReference
  • imageReference
  • footnote
  • footnoteReference
  • math
  • inlineMath

Demo

https://inokawa.github.io/remark-pdf/

Install

npm install remark-pdf

Usage

Browser

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");
})();

Node.js

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);
})();

Documentation

Contribute

All contributions are welcome. If you find a problem, feel free to create an issue or a PR.

Making a Pull Request

  1. Clone this repo.
  2. Run npm install.
  3. Commit your fix.
  4. Make a PR and confirm all the CI checks passed.

Related projects

0.0.13

9 months ago

0.0.10

1 year ago

0.0.11

1 year ago

0.0.12

1 year ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago