Giter Club home page Giter Club logo

md2pdf's Introduction

md2pdf

A small script to convert markdown to pdf using pandoc with custom settings

Dependencies

Arch based Distributions

sudo pacman -S pandoc ttf-dejavu texlive-core

Debian based Distributions

sudo apt install pandoc fonts-dejavu texlive-xetex

Other

You can probably figure it out yourself, based on the two commands above

Manual Installation

  1. Download the md2pdf file:
    wget https://raw.githubusercontent.com/RubixDev/md2pdf/main/md2pdf.sh
  2. Replace 'YOUR NAME HERE' at the top with your actual name. This will appear in the header of the exported PDFs:
    sed -i 's/YOUR NAME HERE/<name>/g' md2pdf.sh
  3. Rename it to md2pdf without .sh:
    mv md2pdf.sh md2pdf
  4. Make the file executable:
    chmod +x md2pdf
  5. Move the file to /usr/local/bin
    sudo mv md2pdf /usr/local/bin/

Automatic Installation

Alternatively, you can also use the automatic install script, which asks for your name (which will appear in the header of the PDFs) and places the file in /usr/local/bin, which should be in your PATH.

For fish users:

wget https://raw.githubusercontent.com/RubixDev/md2pdf/main/install.sh
bash install.sh
rm install.sh

For the rest:

bash -c "$(curl -fsSL https://raw.githubusercontent.com/RubixDev/md2pdf/main/install.sh)"

or

bash -c "$(wget -O- https://raw.githubusercontent.com/RubixDev/md2pdf/main/install.sh)"

Usage

md2pdf <input file> <output file> \
    -l|--left-head [header left text] \
    -c|--center-head [header center text] \
    -r|--right-head [header right text] \
    -n|--name-location [left|center|right] \
    --preserve-tex
  • -l, -c, -r and their long counterparts control the text to appear in the head of each page
  • -n or --name-location followed by one of left, center or right controls where to place the name in the head
    • By default it will be placed left
    • The name can be overwritten by the previously mentioned flags
    • If anything else is provided, the name will not be displayed
  • The --preserve-tex option keeps the generated .tex file

Examples

md2pdf README.md README.pdf

md2pdf README.md README.pdf -l " "

md2pdf README.md README.pdf -l 29.08.2021 -n right

md2pdf README.md README.pdf \
    --center-head "Text with spaces" \
    --right-head 29.08.2021 \
    --name-location left

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.