@dkothule/md2pdf 1.0.1 → 1.0.2
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 +39 -6
- package/install-system-deps.sh +107 -4
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -20,18 +20,51 @@ It keeps Mermaid diagrams sharp in PDF by rendering vector assets (SVG by defaul
|
|
|
20
20
|
|
|
21
21
|
## Install
|
|
22
22
|
|
|
23
|
-
###
|
|
23
|
+
### Frictionless install (recommended)
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
Prerequisite: Node.js + npm installed (required to install the npm package).
|
|
26
|
+
|
|
27
|
+
1) Install md2pdf:
|
|
26
28
|
|
|
27
29
|
```bash
|
|
28
|
-
|
|
30
|
+
npm i -g @dkothule/md2pdf
|
|
29
31
|
```
|
|
30
32
|
|
|
31
|
-
|
|
33
|
+
2) Install runtime dependencies (system packages + `pandocfilters`):
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
md2pdf-install-system-deps
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Use `--yes` to skip the confirmation prompt (helpful for automation):
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
md2pdf-install-system-deps --yes
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
3) Verify:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
md2pdf --version
|
|
49
|
+
md2pdf --help
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
`md2pdf-install-system-deps` supports macOS (Homebrew) and Debian/Ubuntu.
|
|
53
|
+
Run `md2pdf-install-system-deps --help` to see options.
|
|
54
|
+
|
|
55
|
+
### Manual fallback (if helper script does not support your Linux distro)
|
|
56
|
+
|
|
57
|
+
Install these dependencies yourself:
|
|
58
|
+
|
|
59
|
+
- `pandoc`
|
|
60
|
+
- LaTeX PDF engine (`xelatex` default)
|
|
61
|
+
- `librsvg` / `rsvg-convert`
|
|
62
|
+
- `python3` + `pip`
|
|
63
|
+
- `node` + `npm`
|
|
64
|
+
|
|
65
|
+
Then install the Python dependency:
|
|
32
66
|
|
|
33
67
|
```bash
|
|
34
|
-
npm i -g @dkothule/md2pdf
|
|
35
68
|
python3 -m pip install pandocfilters
|
|
36
69
|
```
|
|
37
70
|
|
|
@@ -167,7 +200,7 @@ md2pdf ./tests/samples/mermaid-all-diagram-types.md --keep-mermaid-assets
|
|
|
167
200
|
|
|
168
201
|
## Keywords
|
|
169
202
|
|
|
170
|
-
markdown to pdf, md to pdf, mermaid to pdf, mermaid svg, pandoc markdown pdf, markdown pdf cli, macOS markdown pdf, Linux markdown pdf
|
|
203
|
+
markdown to pdf, md to pdf, md2pdf, mermaid to pdf, mermaid svg, pandoc markdown pdf, markdown pdf cli, macOS markdown pdf, Linux markdown pdf
|
|
171
204
|
|
|
172
205
|
## License
|
|
173
206
|
|
package/install-system-deps.sh
CHANGED
|
@@ -3,8 +3,99 @@
|
|
|
3
3
|
# Copyright (c) 2026 Deepak Kothule
|
|
4
4
|
set -euo pipefail
|
|
5
5
|
|
|
6
|
+
YES=0
|
|
6
7
|
OS="$(uname -s)"
|
|
7
8
|
|
|
9
|
+
usage() {
|
|
10
|
+
cat <<EOF
|
|
11
|
+
Usage: $(basename "$0") [options]
|
|
12
|
+
|
|
13
|
+
Install md2pdf runtime dependencies (system packages + pandocfilters).
|
|
14
|
+
|
|
15
|
+
Options:
|
|
16
|
+
-y, --yes Skip confirmation prompt and proceed immediately
|
|
17
|
+
-h, --help Show this help message
|
|
18
|
+
|
|
19
|
+
Supported platforms:
|
|
20
|
+
- macOS (Homebrew)
|
|
21
|
+
- Debian/Ubuntu Linux (apt)
|
|
22
|
+
EOF
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
parse_args() {
|
|
26
|
+
while [[ $# -gt 0 ]]; do
|
|
27
|
+
case "$1" in
|
|
28
|
+
-y|--yes)
|
|
29
|
+
YES=1
|
|
30
|
+
;;
|
|
31
|
+
-h|--help)
|
|
32
|
+
usage
|
|
33
|
+
exit 0
|
|
34
|
+
;;
|
|
35
|
+
*)
|
|
36
|
+
echo "Error: unknown option: $1" >&2
|
|
37
|
+
usage >&2
|
|
38
|
+
exit 1
|
|
39
|
+
;;
|
|
40
|
+
esac
|
|
41
|
+
shift
|
|
42
|
+
done
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
confirm_install() {
|
|
46
|
+
if [[ "$YES" -eq 1 ]]; then
|
|
47
|
+
return
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
if [[ ! -t 0 ]]; then
|
|
51
|
+
echo "Non-interactive shell detected. Re-run with --yes to proceed." >&2
|
|
52
|
+
exit 1
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
echo "This command will install system packages for md2pdf and may prompt for sudo password."
|
|
56
|
+
echo "Detected OS: $OS"
|
|
57
|
+
printf "Continue? [y/N] "
|
|
58
|
+
local response
|
|
59
|
+
read -r response
|
|
60
|
+
|
|
61
|
+
case "${response,,}" in
|
|
62
|
+
y|yes)
|
|
63
|
+
;;
|
|
64
|
+
*)
|
|
65
|
+
echo "Aborted."
|
|
66
|
+
exit 0
|
|
67
|
+
;;
|
|
68
|
+
esac
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
has_pandocfilters() {
|
|
72
|
+
python3 - <<'PY' >/dev/null 2>&1
|
|
73
|
+
import pandocfilters
|
|
74
|
+
PY
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
install_python_dependency() {
|
|
78
|
+
if has_pandocfilters; then
|
|
79
|
+
echo "Python dependency already installed: pandocfilters"
|
|
80
|
+
return
|
|
81
|
+
fi
|
|
82
|
+
|
|
83
|
+
echo "Installing Python dependency: pandocfilters"
|
|
84
|
+
if python3 -m pip install --user pandocfilters; then
|
|
85
|
+
return
|
|
86
|
+
fi
|
|
87
|
+
|
|
88
|
+
if python3 -m pip install pandocfilters --break-system-packages; then
|
|
89
|
+
return
|
|
90
|
+
fi
|
|
91
|
+
|
|
92
|
+
echo "Failed to install pandocfilters automatically." >&2
|
|
93
|
+
echo "Please install manually with one of:" >&2
|
|
94
|
+
echo " python3 -m pip install --user pandocfilters" >&2
|
|
95
|
+
echo " python3 -m pip install pandocfilters --break-system-packages" >&2
|
|
96
|
+
exit 1
|
|
97
|
+
}
|
|
98
|
+
|
|
8
99
|
install_macos() {
|
|
9
100
|
if ! command -v brew >/dev/null 2>&1; then
|
|
10
101
|
echo "Homebrew is required on macOS. Install from https://brew.sh and retry."
|
|
@@ -12,7 +103,11 @@ install_macos() {
|
|
|
12
103
|
fi
|
|
13
104
|
|
|
14
105
|
brew update
|
|
15
|
-
brew install pandoc librsvg
|
|
106
|
+
brew install pandoc librsvg python
|
|
107
|
+
|
|
108
|
+
if ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then
|
|
109
|
+
brew install node
|
|
110
|
+
fi
|
|
16
111
|
|
|
17
112
|
if ! command -v xelatex >/dev/null 2>&1; then
|
|
18
113
|
echo "Installing BasicTeX for xelatex..."
|
|
@@ -26,14 +121,20 @@ install_debian_ubuntu() {
|
|
|
26
121
|
sudo apt-get install -y \
|
|
27
122
|
pandoc \
|
|
28
123
|
librsvg2-bin \
|
|
29
|
-
nodejs \
|
|
30
|
-
npm \
|
|
31
124
|
python3 \
|
|
32
125
|
python3-venv \
|
|
33
126
|
python3-pip \
|
|
127
|
+
python3-pandocfilters \
|
|
34
128
|
texlive-xetex
|
|
129
|
+
|
|
130
|
+
if ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then
|
|
131
|
+
sudo apt-get install -y nodejs npm
|
|
132
|
+
fi
|
|
35
133
|
}
|
|
36
134
|
|
|
135
|
+
parse_args "$@"
|
|
136
|
+
confirm_install
|
|
137
|
+
|
|
37
138
|
if [[ "$OS" == "Darwin" ]]; then
|
|
38
139
|
install_macos
|
|
39
140
|
elif [[ "$OS" == "Linux" ]]; then
|
|
@@ -49,4 +150,6 @@ else
|
|
|
49
150
|
exit 1
|
|
50
151
|
fi
|
|
51
152
|
|
|
52
|
-
|
|
153
|
+
install_python_dependency
|
|
154
|
+
|
|
155
|
+
echo "Runtime dependencies installed."
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dkothule/md2pdf",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Markdown to PDF converter with high-resolution Mermaid diagram rendering",
|
|
5
5
|
"author": "Deepak Kothule",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
],
|
|
45
45
|
"bin": {
|
|
46
46
|
"md2pdf": "./bin/md2pdf",
|
|
47
|
+
"md2pdf-install-system-deps": "./install-system-deps.sh",
|
|
47
48
|
"md2pdf-install-finder-action": "./scripts/install_md2pdf_quick_action.sh",
|
|
48
49
|
"md2pdf-uninstall-finder-action": "./scripts/uninstall_md2pdf_quick_action.sh"
|
|
49
50
|
},
|