Is there a way download hexdocs as pdf, epub etc?

Is there a way download hexdocs as pdf, epub etc…

1 Like

This won’t answer you directly but if you have a Mac, you can use Dash. You’d be able to save docs from hex.pm for offline usage and search docs. Dash is critical for me in my daily work.

7 Likes

$ mix docs HTML version of docs

$ mix docs --formatter epub epub version of docs

To learn more options

mix help docs

9 Likes

I downloaded ecto 2.2 from github. there is ex_doc already in deps. I did mix deps.get.

$ mix docs
** (Mix) The task "docs" could not be found. Did you mean "do"?

Or Zeal for Windows/Linux (same thing otherwise).

But yeah, the mix docs --formatter <blah> is to use a built in formatter to a different format.

4 Likes

I changed
{:ex_doc, "~> 0.17", only: :docs}, to {:ex_doc, "~> 0.17"}

now mix.docs working

You can also set the environment via MIX_ENV=docs mix docs ... too. :slight_smile:

The default environment is dev.

Also, for note, by removing the only: ... then ex_docs will deploy to production with your app too, which is almost certainly not what you want.

5 Likes

If the project is published with the epub formatter then you can download it fro hex using the following format:

https://hexdocs.pm/package/Package.epub

Here’s Phoenix for example:


https://hexdocs.pm/phoenix/Phoenix.epub

7 Likes

I’ve been using Dash on OSX and now I’m trying to move to Linux full time and the one thing I’m missing in Zeal is the docsets for individual hex packages.

Did you manage to find a way to get these in a format that Zeal can consume?

1 Like

It seems like someone started working on building a hexdocs source for zeal packages, and it seems they got pretty far pretty quick. It should be possible to build something simple like that even on AWS Lambda and S3.

Also, there seem to be some packages for generating Zeal-compatible docsets from source, this seems to be the newest, but I think they need some love to be compatible with later versions of ex_doc, and so on.

2 Likes

Has anyone got Hexdocs successfully working with Zeal?

1 Like

I was able to get my branch to generate the docsets. The pain is you have to manually import them into Zeal.

Is there a way to generate the docs in PDF format? I’m hoping to get PDFs of the Phoenix docs that I can import into other programs and annotate.

When I try PDF, it says formatter module "pdf" not found.

You could convert the epub to pdf with pandoc or Calibre.

1 Like

I tried Pandoc, but it failed on a character, U+251C.

Calibre worked, but the whole process or trying to figure it out how to get the docs as PDF probably took 90 minutes.

It would be useful to have a built-in way to generate the docs as PDFs. PDF is more flexible in some ways, despite the limitation of non-flowing text. You can import PDFs into note-taking software, annotate them, slice up the pages, etc.

I don’t want to take away from the wish to have more flexibility. But I’d want to add that it would come at a cost. PDF is more complex in many steps involved. It’s quite a bit more complex to setup and maintain the code to layout a pdf. It also often needs a bunch of external tooling (or even more elixir native development) to actually create the final pdf. I wouldn’t expect the ex_doc team to pick that up.

But ex_doc formatters can be added on by third parties as well. If someone wants to take a stab at a pdf formatter there should be nothing holding that effort back.

4 Likes