Skip to content

daniellionel01/hexdocs_offline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hexdocs Offline

Package Version Hex Docs

Download an offline version of the hexdocs of your projects dependencies to a local folder.

Useful for if you are travelling a lot and do not have a great or any internet connection at all times. Or if you just want to have a centralized index page for all of the hexdocs of your dependencies and close 10 of those tabs.

How?

All this package does is fetch the dependencies from the gleam.toml file and uses mix hex.docs fetch ... to download a local version of them.

Demo

HEXDOCS.html for this project

Platform Support

This package works fine on macos and linux. It has not been tested on Windows and will probably fail due to the ~/.hex directory default.

Required Software

Apart from Gleam you need to have Mix installed on your system.

Usage

Installation

gleam add hexdocs_offline --dev

Option 1: Default Config

Example Repository

gleam run -m hexdocs_offline

This will generate the hexdocs with the default configuration:

  • gleam_path: ./gleam.toml
  • manifest_path: ./manifest.toml
  • output_path: ./HEXDOCS.html
  • new_tab: True (opens links as a new tab)
  • include_dev: True (includes dev dependencies)
  • ignore_deps: [] (take all dependencies into consideration)

Option 2: Custom Config

Example Repository

//// file `src/dev/generate_hexdocs.gleam`

import hexdocs_offline.{generate}
import hexdocs_offline/config.{
  default_config, with_ignore_deps, with_include_dev, with_output_path,
}

pub fn main() {
  let config =
    default_config()
    |> with_output_path("./HEXDOCS.html")
    |> with_include_dev(False)
    |> with_ignore_deps(["..."])

  generate(config)
}
gleam run -m dev/generate_hexdocs

Notices

  • you might want to add the resulting HEXDOCS.html file to your .gitignore

Development

gleam run   # Run the project
gleam test  # Run the tests

Acknowledgements

License

Apache License, Version 2.0