@speajus/markdown-to-pdf 1.0.8 → 1.0.9

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 CHANGED
@@ -83,6 +83,9 @@ interface PdfOptions {
83
83
  theme?: ThemeConfig; // Typography, colors, and component styles
84
84
  pageLayout?: PageLayout; // Page size and margins
85
85
  basePath?: string; // Base directory for resolving relative image paths
86
+ syntaxHighlight?: boolean; // Enable syntax highlighting (default: true)
87
+ lineNumbers?: boolean; // Show line numbers in code blocks (default: false)
88
+ languages?: string[]; // Prism.js languages to load (default: all)
86
89
  }
87
90
  ```
88
91
 
package/README.pdf CHANGED
Binary file
package/dist/cli.js CHANGED
@@ -20,7 +20,7 @@ async function readMdWritePdf(inputPath, outputPath, extraOptions) {
20
20
  if (!fs_1.default.existsSync(dir))
21
21
  fs_1.default.mkdirSync(dir, { recursive: true });
22
22
  fs_1.default.writeFileSync(path_1.default.resolve(outputPath), buffer);
23
- console.log(`Done. PDF written to ${path_1.default.resolve(outputPath)}`);
23
+ console.log(`PDF written to ${path_1.default.resolve(outputPath)}`);
24
24
  }
25
25
  async function main() {
26
26
  const args = process.argv.slice(2);
package/dist/renderer.js CHANGED
@@ -22,6 +22,7 @@ async function renderMarkdownToPdf(markdown, options) {
22
22
  if (syntaxHighlight) {
23
23
  (0, highlight_prism_js_1.loadHighlightLanguages)(options?.languages);
24
24
  }
25
+ const lineNumbers = options?.lineNumbers ?? false;
25
26
  const emojiFontOpt = options?.emojiFont ?? true;
26
27
  // Use provided image renderer or create default Node.js renderer
27
28
  const imageRenderer = options?.renderImage ?? defaults_js_1.DEFAULTS.renderImage(basePath);
@@ -607,7 +608,7 @@ async function renderMarkdownToPdf(markdown, options) {
607
608
  fontSize: cs.fontSize,
608
609
  lineHeight: 1.5,
609
610
  padding: cs.padding,
610
- lineNumbers: true,
611
+ lineNumbers,
611
612
  drawBackground: true,
612
613
  theme: theme.syntaxHighlight,
613
614
  });
package/dist/types.d.ts CHANGED
@@ -98,6 +98,15 @@ export interface PdfOptions {
98
98
  * Has no effect when `syntaxHighlight` is `false`.
99
99
  */
100
100
  languages?: string[];
101
+ /**
102
+ * Show line numbers in fenced code blocks.
103
+ *
104
+ * Only applies when `syntaxHighlight` is enabled and the code block
105
+ * specifies a language.
106
+ *
107
+ * @default false
108
+ */
109
+ lineNumbers?: boolean;
101
110
  /**
102
111
  * Emoji font configuration.
103
112
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@speajus/markdown-to-pdf",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "A new project created with Intent by Augment.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -30,7 +30,7 @@
30
30
  "scripts": {
31
31
  "build": "tsc && mkdir -p dist/fonts && cp src/fonts/* dist/fonts/",
32
32
  "generate": "tsx samples/generate.ts",
33
- "test": "tsx --test test/*.test.ts && tsx samples/generate.ts"
33
+ "test": "tsx --test test/*.test.ts && tsx samples/generate.ts && tsx ./src/cli.ts README.md README.pdf"
34
34
  },
35
35
  "keywords": [
36
36
  "markdown",