Skip to content
print github nested markdown file all in one pdf
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.elixir_ls
.vscode
config
data
lib
test
.credo.exs
.formatter.exs
.gitignore
CHANGELOG.md
LICENSE
README.md
TODO.md
git2pdf.pdf
mix.exs
mix.lock

README.md

Git2PDF

Description

Git2PDF is a simple parser which can make github nested markdown file all in one PDF.

Notice

Parse a markdown file which has a lot of url links can lead a very long time to make a PDF. The reason is Git2PDF need check every url status, if one links is broken which can throw a exception by wkhtmltopdf and it will faliure. One another is it need sleep 500ms every url check for github anti-crawler strategy.

Installation

before you can use this lib, it need install wkhtmltopdf to parse html to pdf, install guid can found its website.

If available in Hex, the package can be installed by adding git2pdf to your list of dependencies in mix.exs:

def deps do
  [
    {:git2pdf, "~> 0.3.0"}
  ]
end

How to use

Input

iex> GitHubParse.markdown_to_pdf "https://github.com/remoteintech/remote-jobs/blob/master/README.md", 2, false

iex> GitHubParse.markdown_to_pdf "https://github.com/remoteintech/remote-jobs/blob/master/README.md", 2, false, ["--encoding", "utf-8", "-d", "300", "--zoom", "1.5", "--user-style-sheet", "/path/to/your/custom.css"]

Git2PDF use wkhtmltopdf to generate pdf, the last param is wkhtmltopdf's params, your can find more in this link

Output

{"/var/folders/k7/w1zkb4cn0472dk8t_j699pyc0000gn/T/KXiE8hJZ.html", "/var/folders/k7/w1zkb4cn0472dk8t_j699pyc0000gn/T/KXiE8hJZ.pdf"}

You can see this project README.md parse result in this Git2PDF, and you can see it append the CHANGELOG.md to the README.md.

The first is url, sencond is deep_level which mean how deepth which you want it get, the last is whether it check every url in markdown, mostly it doesn't need to check and you don't want to wait too long time.

Change Log

You can’t perform that action at this time.