stas00 / ml-engineering

Machine Learning Engineering Open Book

Home Page:https://stasosphere.com/machine-learning/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

convert markdown to pdf

pengzhangzhi opened this issue · comments

Hi, I had a good read of this book! Wondering if we can convert the markdown files to PDF so that we can print it out to read. I would like to submit a pr for that! Let me know if you are interested!

That's an excellent idea, Zhangzhi.

If it can be automated for sure I'd be happy to receive such a PR.

Have you checked whether the github market perhaps already has an app to do that automatically?

Agreed, @pengzhangzhi. A PDF copy would be nice. For locally converting markdown to a PDF, pandoc seems pretty well known. However, in terms of GitHub automation for this, solutions seem a bit sparse. Perhaps the easiest way to do this would be to add a small blurb at the end of this project's README.md that instructs readers who would like to make a PDF copy of this repo to run the following commands mentioned in this post.

Awesome! Let's do it step by step. I will first write a script to generate pdf locally and then figure out ways to automate this by GitHub automation.

the grip recipe won't work well since this is a multi-file situation. the SO answer @amorehead linked to mentions https://wkhtmltopdf.org/downloads.html which is probably a much better tool for building pdfs from a set of files. So probably need to convert to html first with pandoc and then wkhtmltopdf that.

I would consider to build the pdf through Latex.
In terms of advantages, its rendering is best; it is also way more stable and consistent than html-based solutions (weasyprint and wkhtml2pdf have very different looking results, wkhtml2pdf has not been supported for a while, it's a mess).
In terms of inconvenient its install size is terrible. It's not also technically 'reproducible build' unless you follow a similar approach to what is done by https://github.com/hendricius/the-sourdough-framework (even without that it's much better than the html-based alternatives). Their pdf result (https://www.the-bread-code.io/book.pdf) is kind of perfect too.

commented

Thanks! How to convert markdown to latex... Any framework?

The PDF is almost ready, please give me a few more weeks.

The building workflow is ready, but I need to finish the stylesheets and restructuring the chapters.

If you're impatient, the instructions are here https://github.com/stas00/ml-engineering/tree/master/build - but as I said the stylesheet needs a bit more work.

commented

@stas00 Thanks for making this happen! I had a good read!

Thank you for validating that it is a good read, @pengzhangzhi