@dkothule/md2pdf 1.0.3 → 1.0.5

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
@@ -54,18 +54,22 @@ npm i -g @dkothule/md2pdf
54
54
  2) Install runtime dependencies (system packages + `pandocfilters`):
55
55
 
56
56
  ```bash
57
- md2pdf-install-system-deps
57
+ md2pdf-install-system-deps --yes
58
58
  ```
59
59
 
60
- Use `--yes` to skip the confirmation prompt (helpful for automation):
60
+ If you prefer an interactive confirmation prompt, run:
61
61
 
62
62
  ```bash
63
- md2pdf-install-system-deps --yes
63
+ md2pdf-install-system-deps
64
64
  ```
65
65
 
66
- 3) Verify:
66
+ 3) Verify runtime tools + CLI:
67
67
 
68
68
  ```bash
69
+ pandoc --version | head -n 1
70
+ xelatex --version | head -n 1
71
+ rsvg-convert --version
72
+ python3 -c "import pandocfilters; print('pandocfilters ok')"
69
73
  md2pdf --version
70
74
  md2pdf --help
71
75
  ```
@@ -218,6 +222,9 @@ md2pdf ./tests/samples/mermaid-all-diagram-types.md --keep-mermaid-assets
218
222
  - Flowchart/graph labels missing in PDF: keep `MERMAID_AUTO_PDF_FALLBACK=true`.
219
223
  - Diagram taking a full page: keep `MERMAID_PDF_FIT=true`.
220
224
  - PDF engine missing: install `xelatex` or set `PDF_ENGINE`.
225
+ - On macOS, if `xelatex` is still missing after `md2pdf-install-system-deps`:
226
+ - Add TeX to PATH: `echo 'export PATH="/Library/TeX/texbin:$PATH"' >> ~/.zshrc && source ~/.zshrc`
227
+ - If binary is still missing: `sudo /Library/TeX/texbin/tlmgr install collection-xetex`
221
228
 
222
229
  ## Keywords
223
230
 
@@ -56,9 +56,11 @@ confirm_install() {
56
56
  echo "Detected OS: $OS"
57
57
  printf "Continue? [y/N] "
58
58
  local response
59
+ local normalized_response
59
60
  read -r response
61
+ normalized_response="$(printf '%s' "$response" | tr '[:upper:]' '[:lower:]')"
60
62
 
61
- case "${response,,}" in
63
+ case "$normalized_response" in
62
64
  y|yes)
63
65
  ;;
64
66
  *)
@@ -96,6 +98,61 @@ install_python_dependency() {
96
98
  exit 1
97
99
  }
98
100
 
101
+ ensure_tex_path_macos() {
102
+ local tex_bin="/Library/TeX/texbin"
103
+ if [[ ! -d "$tex_bin" ]]; then
104
+ return
105
+ fi
106
+
107
+ case ":$PATH:" in
108
+ *":$tex_bin:"*)
109
+ ;;
110
+ *)
111
+ export PATH="$tex_bin:$PATH"
112
+ ;;
113
+ esac
114
+ }
115
+
116
+ ensure_xelatex_macos() {
117
+ ensure_tex_path_macos
118
+ if command -v xelatex >/dev/null 2>&1; then
119
+ return
120
+ fi
121
+
122
+ echo "Installing BasicTeX for xelatex..."
123
+ brew install --cask basictex
124
+ ensure_tex_path_macos
125
+
126
+ if command -v xelatex >/dev/null 2>&1; then
127
+ return
128
+ fi
129
+
130
+ local tlmgr_bin="/Library/TeX/texbin/tlmgr"
131
+ if [[ -x "$tlmgr_bin" ]]; then
132
+ if [[ -t 0 ]]; then
133
+ echo "BasicTeX installed but xelatex is still missing. Installing TeX collection-xetex..."
134
+ sudo "$tlmgr_bin" install collection-xetex || true
135
+ ensure_tex_path_macos
136
+ else
137
+ echo "BasicTeX installed but xelatex is still missing."
138
+ echo "Run this command to install it:"
139
+ echo " sudo $tlmgr_bin install collection-xetex"
140
+ fi
141
+ fi
142
+
143
+ if command -v xelatex >/dev/null 2>&1; then
144
+ return
145
+ fi
146
+
147
+ echo "Error: xelatex is still not available." >&2
148
+ echo "If /Library/TeX/texbin/xelatex exists, add TeX to PATH and restart your shell:" >&2
149
+ echo " echo 'export PATH=\"/Library/TeX/texbin:\$PATH\"' >> ~/.zshrc" >&2
150
+ echo " source ~/.zshrc" >&2
151
+ echo "If xelatex binary is missing, install it with:" >&2
152
+ echo " sudo /Library/TeX/texbin/tlmgr install collection-xetex" >&2
153
+ exit 1
154
+ }
155
+
99
156
  install_macos() {
100
157
  if ! command -v brew >/dev/null 2>&1; then
101
158
  echo "Homebrew is required on macOS. Install from https://brew.sh and retry."
@@ -109,11 +166,7 @@ install_macos() {
109
166
  brew install node
110
167
  fi
111
168
 
112
- if ! command -v xelatex >/dev/null 2>&1; then
113
- echo "Installing BasicTeX for xelatex..."
114
- brew install --cask basictex
115
- echo "BasicTeX installed. You may need to restart your shell before retrying."
116
- fi
169
+ ensure_xelatex_macos
117
170
  }
118
171
 
119
172
  install_debian_ubuntu() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dkothule/md2pdf",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Markdown to PDF converter with high-resolution Mermaid diagram rendering",
5
5
  "author": "Deepak Kothule",
6
6
  "license": "MIT",
@@ -52,6 +52,6 @@
52
52
  "postinstall": "echo \"Mermaid CLI installed\""
53
53
  },
54
54
  "dependencies": {
55
- "@mermaid-js/mermaid-cli": "10.9.1"
55
+ "@mermaid-js/mermaid-cli": "11.12.0"
56
56
  }
57
57
  }