Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ibis – A PHP tool that helps you write eBooks in markdown and convert to PDF (github.com/themsaid)
154 points by simonpure on Nov 6, 2020 | hide | past | favorite | 32 comments


Looks like a very nice tool.

Question about the GitHub repo, out of curiosity. Did you only start using git in preparation of the open source release?

I don't know PHP. Since your code base looked clean, was hoping to learn some PHP by following along with your git logs, but the beginning of the Ibis universe was only 2 days ago with a very mature code base.


Not op but I know him via the PHP community. You can find a lot of his code in the laravel framework. Super smart dude.


Thanks! :)


Hey. I started with git since the beginning but wiped out the repo history just before making it public. The commits were all "wip" anyway :D I wasn't sure I'll make it public as I was mainly doing this to generate my eBook.


Any good example repo where you can learn about the code as well as evolution by following the git log and commit history?



haha. That's hilarious :D


Is there something like this but that does markdown to ePub?


Pandoc https://pandoc.org is described as a Universal Document Converter. It can convert markdown (and quite a few other formats) into ePubs, PDFs, doc files, etc. If you need to produce eBooks, Pandoc is a more powerful tool. It's been around for quite a while, and it's very well documented.


I am using pandoc with amazon kdp and it works nicely.

How this tool is different from pandoc?


pandoc supports wide variety of conversions from one format to another, markdown to epub is one of them.

I use pandoc to generate pdf/epub from GitHub style markdown. Here's my custom script for epub: https://learnbyexample.github.io/customizing-pandoc/#customi...


Epubs are zip files, I wrote PHP code that generates the file using the specification. Use the command line apps that already exists if those do the job but if you want to control exactly how the epub content looks don't be afraid dig a bit.


Check out Pandoc!


The authors may want to mention it requires Laravel's Valet and therefore won't work on Windows, WSL, or Linux.


From glancing over the code it seems you use Primarily html to control the layout. Is this assumption right?


Some HTML but mostly CSS.


Yeah that’s what I meant. It seems much more convenient to generate PDF layouts this way than to use standard layout structure like you would with tcpdf or similar.

I know there are a bunch of caveats AKA the browser generally helps renders smarter and some features don’t translate well. But generally I prefer your approach.


The sample PDF looks very pretty!


It looks a bit like a printed webpage though, considering it is supposed to be an A4 paper the font is too large.


I went for the large fonts to make it easier for people to read. You can customize everything about fonts and styling while generating your own book.


This is nice work, thanks for making it a free tool. I looked at the sample on the github page.


Technically commendable. But please please please stop contributing to PDF, especially in the conversion to PDF. It’s a horrible format.


I am sure you have an alternative suitable and ready for the masses?


epub 2 and epub 3 are both much better formats than PDF if you really want to publish ebooks.

PDF is not reflowable and results in a crappy reading experience unless the device screen size is just right.


PDF is ultimately for paper when you care about how the content fits on each page. A reflowable format will have to at some point be rendered to pages if one is to go to paper, and I can't think of anything better than PDF for storing that rendering.


epub is basically many html files packaged together and indexed. So rendering for printing can be taken care of with the right media-querying CSS.


HTML.

Accessible, lighter, works on screen readers, extensible, a standard.


You forgot the horror of printing and rogue JS assisted bitcoin mining.


Printing can actually be fixed with the right CSS. The opposite is not true for PDF: you can't fix PDF for responsive rendering.

As for rogue JS, there are good, open-source countermeasures such as dompurify.


Sure, once we settle one one specific browser, that might be a good idea for publishing things. I have yet to see a HTML with CSS that renders the same on every browser. (A blank page does not count!)


Unless it is the Pandoc markdown dialect (and perhaps not even then) the fact that it is markdown and not some more powerful language, already tells me, that its use is rather limited. If it was for example rst, it would be actually useful also for technical and scientific documents in general, which have sometimes need of document internal referencing of arbitraty elements, not only headings. Then of course all the other things Pandoc markdown brings, that are more geared towards finding a syntax for citations and footnotes etc. If all of that is not available either, the use is already quite limited.


Glancing at the source code it seems that it's GitHub flavored markdown.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: