retypeapp / retype

Retype is an ✨ ultra-high-performance✨ static site generator that builds a website based on simple text files.
https://retype.com
Other
1.06k stars 204 forks source link

Single HTML file of a book #85

Open geoffreymcgill opened 3 years ago

geoffreymcgill commented 3 years ago

Discussed in https://github.com/retypeapp/retype/discussions/84

Originally posted by **larmarange** July 21, 2021 Do you have any plan for allowing to generate (in addition of the website) an HTML file (ideally self-contained) containing all the book allowing to propose to readers to download the overall book and/or to print it as a PDF with their browser.
geoffreymcgill commented 3 years ago

Yes, 100% this is happening. I've had on my TODO list since the beginning of Retype.

We will be providing several print friendly, file download, and eBook download options. This will include:

  1. Print friendly stylesheet, so printing any individual page directly from the browser looks awesome
  2. A per page .pdf download option
  3. An entire content (the "Book") in at least several different formats:
    1. .epub (all content)
    2. .ibooks (might not be required)
    3. .pdf (per page & all book)
    4. .html (might not be required)

We haven't started on any of these features yet, but they are technically trivial for us to implement. Most of the development time will be taken up with UI design and testing.

I'm not exactly sure what release the above (or some of the above) features will be implemented, but it is a priority.

We're a small team and working our way through all the feature requests as fast as we can. That said, all of the above will supported by Retype.

Hope this helps answer your questions.

larmarange commented 3 years ago

Yes thanks. That would be great

Zerotask commented 2 years ago

Any updates on this issue? I'm really looking forward for an option to build the documentation as a single pdf file.

arminus commented 2 years ago

Looking forward to this, too. Does anyone see a "hacked" (pandoc?) way of getting something out, even if not perfect?

DannyBen commented 2 years ago

Does anyone see a "hacked" (pandoc?) way of getting something out, even if not perfect?

There should be a relative easy way to hack something up.

  1. A script that iterates over the files, and removes or modifies all non-standard markdown elements
  2. Then, it concatenates the output to a single markdown file
  3. Then, you can just preview it with any markdown previewer - personally, I am using my own CLI to preview READMEs (madman and save the HTML, or use any other "markdown to HTML" conversion technique.

The bigger challenge, would be to convert the non standard markdown elements.

Another similar approach, would be to

  1. Write a script that iterates and concats all your markdown files, and saves the output back to the source folder
  2. Open the result in Retype... :)
mudgen commented 2 years ago

@geoffreymcgill No PDF support is preventing me from using Retype

p0fi commented 1 year ago

Any updates on PDF support? This is really the missing thing here!

DannyBen commented 1 year ago

Converting individual markdown files into one cohesive PDF book is not a trivial task.

From dev perspective, it involves two tasks:

Task 1: Concatenating markdowns, which will require:

Task 2: Converting markdown to HTML and then to PDF

While it can be done in a server environment (one that render server-side markdown to HTML), it is - to my knowledge - quite impossible to do on a client side, without bringing in bloated software to do so.

Personally, I do not know of any other documentation tool generator that does that - I would love to be enlightened if there is any.

I believe the only course of action for Retype developers (if any) is to render a special HTML page (say "my-retype-site.com/book"), which will create the HTML render of everything (i.e. Task 1), and then the user can use their already available "Download as PDF" in Chrome or other modern browser.

p0fi commented 1 year ago

Im well aware that this is not trivial, it's a really important feature nevertheless in my eyes.

Personally, I do not know of any other documentation tool generator that does that - I would love to be enlightened if there is any.

Gitbook does that. See Gitbook Docs – PDF Export

DannyBen commented 1 year ago

I understand. But Gitbook is a hosted service, retype is a static site generator.

lnarynskyyi commented 1 year ago
  • Print friendly stylesheet, so printing any individual page directly from the browser looks awesome
  • A per page .pdf download option
  • An entire content (the "Book") in at least several different formats:

    1. .epub (all content)
    2. .ibooks (might not be required)
    3. .pdf (per page & all book)
    4. .html (might not be required)

I understand the additional complexity involved in # 3 (entire "book"), but the first two points seem much more trivial. Since Retype doesn't currently support at-rules @page { @top-right {...}} it's damn near impossible to get a nice printout of a single article.

Any updates on this @geoffreymcgill?

geoffreymcgill commented 1 year ago

@p0fi Nice. Thanks for that.

ApolonTorq commented 1 year ago

Just an FYI. Refer to #628 for a somewhat "hacky" workaround that can be used as an interim measure for single page pdfs.