Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Would love an PDF version #47

Open
holgern opened this issue Nov 26, 2020 · 7 comments
Open

Would love an PDF version #47

holgern opened this issue Nov 26, 2020 · 7 comments

Comments

@holgern
Copy link
Contributor

holgern commented Nov 26, 2020

Thank you for your great work.
I find the webpages quite hard to read and I would love a PDF version.

Could I help in creating one? Do you have an idea in how to realize this?

I'm familiar with latex but I have no idea in how to sync the content between the jekyll sites and tex files.
Could pandoc be a solution?

@holgern holgern changed the title Would love a PDF version Would love an PDF version Nov 26, 2020
@mflaxman
Copy link
Contributor

I'm a fan of the idea, but IKD if there's an easy way to do that with jekyll. If there's an automated way that will stay in sync with each update, I'd like it.

There also may be a 3rd party tool that crawls your website and makes it into a PDF automatically, which has obvious security negatives but would be easy.

@holgern
Copy link
Contributor Author

holgern commented Nov 26, 2020

It seems there are a few options to explore: https://mattgilbertnet.github.io/colloidsorg/informatics/2014/08/03/markdown_latex_pdf.html

  • Jekyll plugin from Markdown to PDF via Pandoc LaTeX
  • Markdown to PDF without LaTeX
  • Direct html5 to PDF conversion without LaTeX
  • Kramdown: Markdown to LaTeX, some cleanup required

The kramdown way seems a possible way:

  • convert each md file into a tex file with kramdown
  • fix image paths
  • remove YAML
  • Read out the structure and apply it to the latex document (parse next_url)
  • use input in latex to add the tex files into a latex document
  • build a PDF from the latex source files

@holgern
Copy link
Contributor Author

holgern commented Nov 28, 2020

I decided to go for the pandoc + LaTeX solution:

  • document toc needs to be processed
  • pandoc can read the markdown files directly
  • yaml header needs to be removed
  • includes needs to be resolved
  • image link path needs to be fixed
  • Number of # needs to be adapted

After doing these steps by hand, a PDF could be created (there are some unresolved includes in the last chapter and some wrong headers)

@mflaxman What do you think? Should I proceed?
btcguide.pdf

@holgern
Copy link
Contributor Author

holgern commented Dec 10, 2020

I created a new branch: https://github.com/holgern/btcguide.github.io/tree/btcguide-pandoc

The changes on the markdown files can be checked here:
master...holgern:btcguide-pandoc

I decided to do the changed by hand, and with help of the compare function it will be easy to merge changes to the pandoc branch.

@mflaxman can you create a new branch and add my branch to your repo? Then PR for the pdf, ebook and mobi could be created and merged.

Adaption of the scripts for Linux and mac are still needed. At the moment they work only on windows. I think it will be easy to port them.

The created files can be found here:

I created also a release with these files:
https://github.com/holgern/btcguide.github.io/releases/tag/v0.2

@mflaxman
Copy link
Contributor

Sorry for the delay, just digging into this now. Wow this is cool!

I want to separate content changes from feature (PDF/ebook) changes. If you can break it up into 2 PRs I can merge sequentially. Or if you'd rather I just grab from your branch I can do that (would steal your git cred)?

If it were any extra work I'd say that PDF gets you 99% of the way there, but since it doesn't seem to be harder supporting both is nice.

Does that make sense?

@holgern
Copy link
Contributor Author

holgern commented Jan 8, 2021

@mflaxman I found a way with LUA filters to generate a PDF and a EPUB file directly from the markdown files in _pages.
The only necessary changes are new lines before a list. I put these changes to a PR: #59
When you accept this PR, I will create a second one and add the lua filters and the pandoc script to create a pdf / epub.

@holgern
Copy link
Contributor Author

holgern commented Jan 18, 2021

The newest documents can be currently found here:
https://github.com/holgern/btcguide.github.io/releases/latest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants