vscode-markdown-pdf
vscode-markdown-pdf copied to clipboard
Would it support command line convert?
It will be more convenient if command-line is supported
We have several markdown files that are created by a variety of people at any time, it really would be useful in our case to execute the pdf conversion from the command line as well (versus right clicking dozens of times). I also checked if VSCode had a straightforward to just automate right clicking but didn't see anything.
badly missing command line tool for linux...
Command line
Currently tested in the following environments:
- node v14.15.5
- windows11
# install
> npm i -g markdown-to-file
# help
> m2f
Usage: m2f <md> [type] [options...]
md -- path to markdown file to convert
type -- Output file format: pdf|html|jpeg|png|all
options -- See: https://github.com/wll8/markdown-to-file
Eg:
m2f README.md
m2f README.md html
m2f README.md pdf outputDirectory=./mydoc/ markdown-it-include.enable=false
Command line
Currently tested in the following environments:
- node v14.15.5
- windows11
Thanks. Tested on Mac and Ubuntu Server 20.04. It works on Mac and doesn't work on Ubuntu. It converted to html only if it is run on Ubuntu. No error messages but it left temporary html file when I tried to convert md to pdf.
@bladerunner2020 Not sure if the requirement must require Ubuntu to have the UI system installed.
You can try to install vscode in Ubuntu and try to use the original plugin to see if it can be generated (probably not) to help troubleshoot the problem.
@bladerunner2020 Not sure if the requirement must require Ubuntu to have the UI system installed.
You can try to install vscode in Ubuntu and try to use the original plugin to see if it can be generated (probably not) to help troubleshoot the problem.
This should be my job, let me troubleshoot these issues.
Please try to install the following dependencies in ubuntu:
sudo apt update
sudo apt install gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
I went through the above steps and can export the pdf successfully.
For details, please refer to chrome-headless-doesnt-launch-on-unix
A new version of markdown-to-file has been released which does not mask the error log.
Please try to install the following dependencies in ubuntu:
sudo apt update sudo apt install gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
I went through the above steps and can export the pdf successfully.
For details, please refer to chrome-headless-doesnt-launch-on-unix
Now it does work! That's incredible! Now we can setup our CI for documentation. Thank you very much.
The only thing left - need to find out the best way to install chromium to avoid installation of first run.
I have created a docker image to use markdown-to-file as part of CI/CD job. https://hub.docker.com/repository/docker/bladerunner2020/markdown-to-file