Skip to content

A tool to convert markdown with help of pandoc and LaTeX to pdf

License

Notifications You must be signed in to change notification settings

p3t3r67x0/markdown-converter

Repository files navigation

📰 markdown-converter

mit license github build status repository size python version docker build

A tool to convert markdown with help of pandoc and LaTeX to pdf

Write markdown and convert it to pdf

This tool downloads all images from any online markdown repository and converts it with help of pandoc and LaTeX into a beautiful pdf. There is also an image converter integrated to convert anmimated gif or svg images into a png image. All together this tool turns text, images, links as well as emojies 🚀 into a pdf file.

You can choose to build the markdown converter or to run the docker container

📦 Docker Hub

Make use of the pre build docker image

docker pull opendatacoder/markdown

📦 Docker Usage

docker run --rm -v $PWD:/home/latex/data/output opendatacoder/markdown --format md \
  --output readme --input https://raw.githubusercontent.com/repository/project/README.md

In case you want to access the container you can run this command

docker run --rm -it --entrypoint /bin/bash opendatacoder/markdown

🧱 Local Docker Setup

To run the docker container have a look at Docker Usage section

docker build -t markdown .

🧱 Local Build Setup

# install build dependencies on debian or ubuntu
sudo apt install virtualenv python3.7 python3.7-dev \
pandoc gir1.2-rsvg-2.0 libcairo2-dev libgirepository1.0-dev \
python3-cairo python-gi-cairo python3-gi texlive-full

# create a virtualenv
virtualenv -p /usr/bin/python3.7 venv

# activate virtualenv
. venv/bin/activate

# install dependencies
pip3 install -r requirements.txt

🧱 Local Usage

Here you have a few usage examples which you can try as well on the Docker container

🧾 Convert markdown to LaTeX and PDF

HINT: You can choose between different --format options like md or gfm and html.

Fetch all assets from a remote url and convert a markdown into a LaTeX file and render a pdf.

./convert.py --format md --output readme --input \
  https://raw.githubusercontent.com/repository/project/README.md

🧾 Convert markdown to LaTeX

Use the --dry flag to not render a pdf file but convert the markdown into a LaTeX file with all fetched assets.

./convert.py --format md --output readme --dry --input \
  https://raw.githubusercontent.com/repository/project/README.md