@speajus/markdown-to-pdf 1.0.16 → 1.0.17

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.
Binary file
Binary file
package/dist/renderer.js CHANGED
@@ -37,7 +37,7 @@ async function renderMarkdownToPdf(markdown, options) {
37
37
  ? options.emojiFont
38
38
  : themeEmojiFont === 'none'
39
39
  ? false
40
- : themeEmojiFont; // 'twemoji' | 'openmoji'
40
+ : themeEmojiFont; // 'twemoji' | 'openmoji' | 'noto'
41
41
  // Use provided image renderer or create default Node.js renderer
42
42
  const imageRenderer = options?.renderImage ?? defaults_js_1.DEFAULTS.renderImage(basePath);
43
43
  const { margins } = layout;
@@ -57,12 +57,15 @@ async function renderMarkdownToPdf(markdown, options) {
57
57
  // eslint-disable-next-line @typescript-eslint/no-require-imports
58
58
  const nodeFs = require('fs');
59
59
  let fontPath;
60
- if (typeof emojiFontOpt === 'string' && emojiFontOpt !== 'twemoji' && emojiFontOpt !== 'openmoji' && emojiFontOpt !== 'none') {
60
+ if (typeof emojiFontOpt === 'string' && emojiFontOpt !== 'twemoji' && emojiFontOpt !== 'openmoji' && emojiFontOpt !== 'noto' && emojiFontOpt !== 'none') {
61
61
  fontPath = emojiFontOpt; // custom file path
62
62
  }
63
63
  else if (emojiFontOpt === 'openmoji') {
64
64
  fontPath = nodePath.join(__dirname, 'fonts', 'OpenMoji-Color.ttf');
65
65
  }
66
+ else if (emojiFontOpt === 'noto') {
67
+ fontPath = nodePath.join(__dirname, 'fonts', 'NotoColorEmoji.ttf');
68
+ }
66
69
  else {
67
70
  fontPath = nodePath.join(__dirname, 'fonts', 'Twemoji.Mozilla.ttf');
68
71
  }
package/dist/types.d.ts CHANGED
@@ -92,9 +92,10 @@ export interface ThemeConfig {
92
92
  /** Emoji font to use for rendering emoji characters.
93
93
  * - `'twemoji'` (default) — use the bundled Twemoji.Mozilla.ttf color emoji font.
94
94
  * - `'openmoji'` — use the bundled OpenMoji-Color.ttf (COLR) emoji font.
95
+ * - `'noto'` — use the bundled NotoColorEmoji.ttf (CBDT) emoji font.
95
96
  * - `'none'` — disable emoji font; emoji render with the body font.
96
97
  */
97
- emojiFont?: 'twemoji' | 'openmoji' | 'none';
98
+ emojiFont?: 'twemoji' | 'openmoji' | 'noto' | 'none';
98
99
  }
99
100
  /**
100
101
  * A custom font definition providing font data for registration with PDFKit.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@speajus/markdown-to-pdf",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
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
  ],
31
31
  "scripts": {
32
32
  "build:pdfkit": "node -e \"const fs=require('fs'),p=require('path'),{execSync:e}=require('child_process'),d=p.join('node_modules','pdfkit','js');if(!fs.existsSync(d)){const t='/tmp/pdfkit-build-'+Date.now();e('git clone --depth 1 --branch support-color-emoji-google https://github.com/jspears/pdfkit.git '+t,{stdio:'inherit'});const pd=p.resolve('node_modules/pdfkit');for(const f of['lib','rollup.config.js','.babelrc','yarn.lock']){const s=p.join(t,f);if(fs.existsSync(s)){e('cp -r '+s+' '+pd,{stdio:'inherit'})}}e('cd '+pd+' && npm install --ignore-scripts && npx rollup -c',{stdio:'inherit'});e('rm -rf '+t,{stdio:'inherit'})}\"",
33
- "postinstall": "node -e \"if(require('fs').existsSync('src')){require('child_process').execSync('npm run build:pdfkit',{stdio:'inherit'})}\" || true",
33
+ "postinstall": "node -e \"if(require('fs').existsSync('src')){require('child_process').execSync('npm run build:pdfkit',{stdio:'inherit'})}\" || true && node scripts/patch-fontkit-colr.js",
34
34
  "docs:dev": "cd docs && $npm_execpath dev",
35
35
  "build": "tsc && mkdir -p dist/fonts && cp src/fonts/* dist/fonts/",
36
36
  "generate": "tsx samples/generate.ts",