laserpilot / Survey_of_Alternative_Displays

Alternative Display writeup repo
46 stars 6 forks source link

Make export as PDF available? #4

Open ffd8 opened 1 year ago

ffd8 commented 1 year ago

Have been following this project since v1 years ago – thankyouverymuch for this amazing resource and keeping it up to date! In the original Medium post, you also offered a PDF download, which was really useful to share with students and for archive sake. Have you considered activating the gitbook pdf export option? While it risks falling out of date (maybe give it a datestamp to help know), it could be exported 1x per year (or on each update) and archived within the releases section of this repo?

laserpilot commented 1 year ago

Thanks so much!

I, too, would love to do the PDF export and it was an issue I was considering when changing formats to this current gitbook path. The unfortunate side is that PDF export for gitbook means I need a Pro subscription which requires a setup fee and a per-user fee which would land me at like roughly $120 for just a single month just for the one-time ability to export to PDF. I'm not opposed to it (and should probably just ask for donations), it's just unfortunate that it is that much for a paywall feature for an otherwise free resource.

I looked at other hosting options out there for easy PDF/website exports but didn't find any that I truly loved and felt were easy to update and had the longevity of being based in Markdown. I looked at stuff like Notion which also cost money/no long-term guarantee, and also Magicbook https://github.com/magicbookproject/magicbook but had a hard time getting it to a format and style I liked without a ton of tinkering.

In any case, if someone else sees this and has an idea, please let me know!

laserpilot commented 1 year ago

I made some slight progress on this - I found an open source update to Gitbook called Honkit https://github.com/honkit/honkit but the unfortunate thing is that it will take quite a bit of reformatting of my embed tags for proper exports (and I think I'll need to capture a jpg/png placeholder for each video when it renders as well)

Its not outside the realm of possibility, but unfortunately it looks like to even attempt to export with honkit, id have to modify a few hundred tags (probably manually) before I can even do an export

ffd8 commented 1 year ago

Thanks for looking into this! Such a shame that an important archival feature requires a pro account. Great the whole setup is in .md files – but of course tricky for packaging due to that.. I also did some research on the gitbook to pdf and found the following:

Here's the PDF output I got from that last script: Survey_of_Alternative_Displays.pdf

laserpilot commented 11 months ago

Ah thanks so much for the extra research and taking the time to get the script run - this looks great. I can't believe it's 72 pages long all written out, hah.

I agree, It's a shame that the gitbook %embed tag doesn't seem to be portable to other formats or be handled well - I'm not opposed to how it looks currently from what you output and it would probably take me many hours to find a good way to screenshot all of those and find a way to substitute things in. Maybe I'll take another look and at least try to fix some of the video embeds.

Maybe there is some other script I could run/find that could grab an image preview for every embed tag in there and at least save it as an image file. Maybe a job for chatgpt to write me that script, hah.

laserpilot commented 11 months ago

so ive got your same result working with that gitbook _to_pdf.sh gist -

I also have a script now that pulls thumbnails for every video in the writeup (about 150 videos, sheesh), and another script that will ideally go in and replace every %embed tag with an image markdown tag that links to the local images just downloaded and leaves the video link. im going to see how far I can take that, even though im sure it will inevitably introduce some errors somewhere. I'll keep you posted

laserpilot commented 11 months ago

Another 2 week later update - I actually had some success with this, but it took a while to put together. I basically made a set of scripts to do these things. I could be more elegant about it, but this is the basic list of functions I had to go through: -Script to look for all YouTube/vimeo links and download thumbnails for each one via yt-dlp/YouTube-dl -Script to convert all thumbnails to jpg (some come in as webp, but didnt look at yt-dlp options to force it) -Script to search through all markdown files, and replace all embedded videos with a matching image/thumbnail and preserve the link -Regenerate the pdf and change a few relative paths because oh how pandoc handles paths

since I moved fast and had to use a lot of absolute paths on my machine, I'm not sure if ill upload the functional scripts on here, but I can definitely put the pdf somewhere - I might throw it on my personal site instead of GitHub and just link from here. It currently weighs about 25mb and is about 126 pages

ffd8 commented 11 months ago

That sounds awesome! many thx for digging further into this and finding a way to replace the %embed.. with the actual thumbnails etc. Gooo yt-dlp! Yeah, if the scripts are very machine/absolute-path specific, perhaps doesn't really help someone else, nor necessary to do it once done once per update. The compiled PDF would surely be helpful to others. Can one put such a file as a 'release' for the repo? Or is that function different/cost because of gitbook? Hosting either place would be fine – but might make more sense within github and prevent chances of it breaking if your own webhost structure changes/etc (link rot..).

laserpilot commented 11 months ago

Yeah I think manually creating the book is probably ideal, and I'm fine to do it. I just need to write myself a readme soon so I dont forget the process - I doubt more than a couple people would ever do it and it's definitely an error prone process.

Anyway - here is the link to the 2022 version as a PDF on my site. now I need to make some 2023 or 2024 updates with new stuff! https://ablairneal.com/survey-of-alternative-displays-2022-edition

ffd8 commented 11 months ago

Haha good idea to leave your future self some notes on the work/scriptflow. FYI, that link didn't work for the PDF.. when clicking on the link, it updates with an error staying [No file paths defined.](https://ablairneal.com/download/794/?tmstv=1697745640).

laserpilot commented 11 months ago

Thanks - yeah some Wordpress issue with my download manager I just noticed too, but I just fixed it and it should be all good now!