This pdf builder has an implicit rule. The more pure markdown your document is, the better it will look!
Concretely this means pure markdown syntax is better handled by this pdf builder than HTML one.
This rule impacts:
- links (blue color)
- images (handle width, add a figure title)
You can find supported formats for lists, images, links, and table in the assets/syntax_guidelines.md
file.
The pdf_builder supports two modes:
- simple (for a single project)
- bootcamp (for bootcamp days)
The pdf_builder uses latex and a library called pandoc, you can follow this link for the installation procedure of pandoc.
Also install the following packages
tlmgr update --self
tlmgr install ucs fvextra sectsty ucs cancel framed titlesec
You can install the pdf_builder with pip
pip install git+https://github.com/42-AI/42ai_pdf_builder.git
The pdf builder can also use Docker to isolate the execution environment (like a virtual machine). We can install Docker using assets/init_docker.sh
script.
This script was originally written by Alexandre GV., a 42 student.
A Dockerfile
is available in the assets
directory.
First, we need to build the docker image for pdf_builder. Our image will be named pdf_builder
.
cd assets/
DOCKER_BUILDKIT=1 docker build -t pdf_builder .
nb: the DOCKER_BUILDKIT
option is an optimization for the build (parallelizes download and add a delta system for consecutive builds). It also has a cache you will need to prune if you want to save some space (see the end of README).
Then we can run the docker container. Our docker container will also be named pdf_builder
.
docker run --name pdf_builder -d -t pdf_builder
First, we need to connect to the docker container.
docker exec -it pdf_builder /bin/sh
We arrive in the /data
directory of the container with the pdf_builder.
$> ls
pdf_builder
$> cd pdf_builder
pdf-builder simple
supports the following arguments :
- project-title : the project title
- input-directory : input directory
- output-path : Path to save the pdf to
- logo-file : Logo image file to use for the project
- template-file : Latex Template file to use for the project
pdf-builder bootcamp
supports the following arguments :
- bootcamp-title : the bootcamp title
- input-directory : input directory
- day-title : Title of the day
- output-path : Path to save the pdf to
- logo-file : Logo image file to use for the project
- template-file : Latex Template file to use for the project
You can clone your project wherever you want and use the pdf_builder.
git clone https://github.com/42-AI/bootcamp_data-engineering
Now, you can build your pdf.
pdf-builder bootcamp -b "Data Engineering" -d /data/bootcamp_data-engineering/day00 -t "Day00 - PostgreSQL" -o day00.pdf
You now have a pdf file in your container. You can copy it out of your container with the following command.
docker cp pdf_builder:/data/day00.pdf .
You finally have the pdf in your laptop filesystem, enjoy!
When you are done, you can destroy the container and image with the following commands.
docker stop pdf_builder
docker rm pdf_builder
docker image rm pdf_builder
With this command, everything linked to docker (images, caches, containers) are removed. It's like if you restarted with a freshly installed docker. This allows you to free memory space.
docker rm -f $(docker ps -a -q)
docker rmi -f $(docker ps -a -q)
docker system prune -a