@speajus/markdown-to-pdf 1.0.13 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -19
- package/README.pdf +0 -0
- package/dist/cli.js +3 -0
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A lightweight TypeScript library that converts Markdown files into styled PDF documents. Built on [marked](https://github.com/markedjs/marked) for parsing and [PDFKit](https://pdfkit.org/) for PDF generation. [README.pdf](./README.pdf) | [Live Demo](https://speajus.github.io/markdown-to-pdf/)
|
|
4
4
|
|
|
5
|
-
[](https://speajus.github.io/markdown-to-pdf/)
|
|
5
|
+
-[]([https://speajus.github.io/markdown-to-pdf/](https://speajus.github.io/markdown-to-pdf/))
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
@@ -128,16 +128,16 @@ await generatePdf(markdown, {
|
|
|
128
128
|
|
|
129
129
|
The full `ThemeConfig` interface exposes styles for:
|
|
130
130
|
|
|
131
|
-
| Section
|
|
132
|
-
|
|
|
133
|
-
|
|
|
134
|
-
|
|
|
135
|
-
|
|
|
136
|
-
|
|
|
137
|
-
|
|
|
138
|
-
|
|
|
139
|
-
|
|
|
140
|
-
|
|
|
131
|
+
| Section | Configurable properties |
|
|
132
|
+
| --- | --- |
|
|
133
|
+
| headings | Font, size, and color for each level (h1–h6) |
|
|
134
|
+
| body | Font, size, color, and line gap |
|
|
135
|
+
| code.inline | Font, size, color, and background color |
|
|
136
|
+
| code.block | Font, size, color, background color, and padding |
|
|
137
|
+
| blockquote | Border color, border width, italic flag, and indent |
|
|
138
|
+
| table | Header background, border color, cell padding, and zebra color |
|
|
139
|
+
| linkColor | Color for hyperlink text |
|
|
140
|
+
| horizontalRuleColor | Color for --- dividers |
|
|
141
141
|
|
|
142
142
|
## Project Structure
|
|
143
143
|
|
|
@@ -163,18 +163,18 @@ The full `ThemeConfig` interface exposes styles for:
|
|
|
163
163
|
## Dependencies
|
|
164
164
|
|
|
165
165
|
| Package | Purpose |
|
|
166
|
-
|
|
|
167
|
-
|
|
|
168
|
-
|
|
|
169
|
-
|
|
|
166
|
+
| --- | --- |
|
|
167
|
+
| marked | Markdown parsing and tokenization |
|
|
168
|
+
| pdfkit | PDF document generation |
|
|
169
|
+
| @resvg/resvg-js | SVG-to-PNG rasterization for image embedding |
|
|
170
170
|
|
|
171
171
|
## Scripts
|
|
172
172
|
|
|
173
173
|
| Command | Description |
|
|
174
|
-
|
|
|
175
|
-
|
|
|
176
|
-
|
|
|
174
|
+
| --- | --- |
|
|
175
|
+
| npm run build | Compile TypeScript to dist/ |
|
|
176
|
+
| npm run generate | Generate sample PDFs from samples/*.md into output/ |
|
|
177
177
|
|
|
178
178
|
## License
|
|
179
179
|
|
|
180
|
-
ISC
|
|
180
|
+
ISC
|
package/README.pdf
CHANGED
|
Binary file
|
package/dist/cli.js
CHANGED
|
@@ -9,6 +9,9 @@ const path_1 = __importDefault(require("path"));
|
|
|
9
9
|
const fs_1 = __importDefault(require("fs"));
|
|
10
10
|
const index_js_1 = require("./index.js");
|
|
11
11
|
async function readMdWritePdf(inputPath, outputPath, extraOptions) {
|
|
12
|
+
if (inputPath === outputPath) {
|
|
13
|
+
throw new Error(`input path can not be the same as output path.`);
|
|
14
|
+
}
|
|
12
15
|
console.log(`Converting ${inputPath} → ${outputPath}`);
|
|
13
16
|
const resolvedInput = path_1.default.resolve(inputPath);
|
|
14
17
|
const markdown = fs_1.default.readFileSync(resolvedInput, "utf-8");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@speajus/markdown-to-pdf",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.14",
|
|
4
4
|
"description": "A new project created with Intent by Augment.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -29,9 +29,11 @@
|
|
|
29
29
|
"README.md"
|
|
30
30
|
],
|
|
31
31
|
"scripts": {
|
|
32
|
+
"docs:dev": "cd docs && $npm_execpath dev",
|
|
32
33
|
"build": "tsc && mkdir -p dist/fonts && cp src/fonts/* dist/fonts/",
|
|
33
34
|
"generate": "tsx samples/generate.ts",
|
|
34
|
-
"
|
|
35
|
+
"readme": "pnpm tsx ./src/cli.ts README.md README.pdf",
|
|
36
|
+
"test": "tsx --test test/*.test.ts && tsx samples/generate.ts && pnpm run readme"
|
|
35
37
|
},
|
|
36
38
|
"keywords": [
|
|
37
39
|
"markdown",
|