-
Notifications
You must be signed in to change notification settings - Fork 13
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
[RFC] Download as PDF #136
Comments
This is a tricky problem. I'm not super excited about the overhead of adding a GitHub action for Option 3. It will certainly generate Git merge conflicts when multiple branches update the spec. This problem is similar to the starter files tarball problem and most people (including instructors) are helpless when it comes to resolving merge conflicts. I kinda like Option 1 despite its limitations. |
Update: I am one step closer to making this a reality! 😃 Now that GitHub Pages can be deployed via GitHub Actions, we can run arbitrary commands to generate static files. I created a custom action to build Primer Spec (see #212). For the past month, I've been playing around trying to get dynamic PDF generation to work. Thanks to amazing support from GitHub's Support team, I have a working prototype!
Now, all that's left is to figure out how to create a UI in Primer Spec to link students to the PDF. I'll need some time to explore UIs (and maybe correspond with @bellakiminsun) — meanwhile, I'd welcome suggestions and design proposals from anyone 😄 |
Yay for pdfs 🎉🎉🎉🎉
2022년 10월 21일 (금) 오후 11:37, Sesh Sadasivam ***@***.***>님이 작성:
… Update: I am one step closer to making this a reality! 😃
Now that GitHub Pages can be deployed via GitHub Actions, we can run
arbitrary commands to generate static files. I created a custom action
<https://github.com/seshrs/build-primer-spec-action> to build Primer Spec
(see #212 <#212>).
For the past month, I've been playing around trying to get dynamic PDF
generation to work. Thanks to amazing support from GitHub's Support team, I
have a working prototype!
- GitHub Action:
https://github.com/seshrs/build-primer-spec-action/blob/48edf3da1472a337b3c827a3de198646901bafdd/action.yml#L24-L51
- Example page:
https://seshrs.github.io/ci-playground/nested-dir/nested-spec-test.html
- Corresponding PDF:
https://seshrs.github.io/ci-playground/assets/primer-spec-pdf/nested-dir/nested-spec-test.pdf
Now, all that's left is to figure out how to create a UI in Primer Spec to
link students to the PDF. I'll need some time to explore UIs (and maybe
correspond with @bellakiminsun <https://github.com/bellakiminsun>) —
meanwhile, I'd welcome suggestions and design proposals from anyone 😄
—
Reply to this email directly, view it on GitHub
<#136 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFQ2TWVMXCUUIUBJFJGFKZDWEODQ3ANCNFSM5HUHHY7A>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Motivation
One of Primer Spec's features is that print-previews are beautifully-formatted, so students can use their browsers' "Print to PDF" functionality to save copies of a spec for offline access.
However, I think I've seen Piazza questions from students asking the same question. I think many students may not be familiar with their browsers' "Print to PDF" capability, or maybe they assume that the spec won't look good when printed.
Ideally, Primer Spec should show some UI to let students know that they can save specs as a PDF. But how do we do it?
Options I considered
Option 1: Educate students about "Print to PDF"
Pros:
Cons:
Option 2: Generate the PDF from JavaScript
I explored multiple JS --> PDF options over the past few weeks. Click here for details.
It seems like the most appropriate implementation here is to use PDFMake in conjunction with html-to-pdfmake.
Pros:
Cons:
Example page generate by Option 2
Option 3: GitHub Actions generates PDF using headless Chrome
Click here for details on how it would work.
CONTENT_HASH
PATH_HASH
pdfs/_.pdf
CONTENT_HASH
. Also computePATH_HASH
.pdfs/_.pdf
. If the file exists, show a "download" button in the UI.Pros:
Cons:
Option 4: Create an HTML --> PDF server
Like Prince. But the server could literally use Chrome to render the PDF and return it.
We'd probably need to create a system that prevents spamming the server.
Pros:
Cons:
My opinion: I like Option 3 (GitHub Actions)
Personally, I prefer Option 3 (GitHub Actions workflow generates PDF). I like it best because of the high-quality PDFs, but I'm not super-happy that course websites need to integrate using GitHub Actions.
Option 2 (generate a bespoke PDF) is also good, but will involve much more work in figuring out how to make a nice-looking PDF. Also, the resulting PDF will never look like a Primer Spec page (but maybe that's a good thing...?)
I don't like Option 1 (UI to educate users) 😆
Option 4 (HTML --> PDF server) involves spam/abuse challenges, and there's a financial cost too.
NOTE: We also need to think about stale PDFs — what if the spec changes after a student has downloaded the PDF? It should be possible for a student to compare their PDF with the contents on a course's website. Essentially, this would be a combination of #92 and including the download-date in the PDF. (This is another reason I like Option 3, it builds the system needed for #92 to work.)
Request for Comments
Comments and suggestions are appreciated! Next week, I'll begin implementing Option 3 if there are no differing opinions.
The text was updated successfully, but these errors were encountered: