Code Monkey home page Code Monkey logo

hexdocs_docset_api's Introduction

DocsetApi

An API that produces docset packages (for https://zealdocs.org & dash.app) from any Elixir app or library with hexdocs documentation.

Feed API

  1. Start the server with PORT=8080 mix phx.server (or whatever port is available on your machine)
  2. In Zeal, go to tools -> docsets -> Installed -> Add Feed
  3. Insert the url in the format, http://localhost:8080/feeds/<package_name>

Done!

CLI

You can generate a docset for a library which will be pulled from hex.pm/hexdocs:

iex> DocsetApi.Builder.build("phoenix", "priv/static/docsets")

Or you can go further and generate docsets for your own Elixir application + all of its dependencies at once.

Add DocsetApi as a dependecy in mix.exs:

{:docset_api, only: :dev, runtime: false, git: "https://github.com/mayel/hexdocs_docset_api.git"}

Put a mix task like this one in your app:

defmodule Mix.Tasks.MyApp.GenerateDocsets do
  use Mix.Task

  @usage "mix my_app.generate_docsets PATH"

  @shortdoc "Generate Dash-compatible docsets for the app and dependencies."
  @moduledoc """

  Usage:

    $ #{@usage}
  """

  def run([path | _]) when is_binary(path) do
    Mix.Task.run("docs")
    Mix.Task.run("app.start")

    # generate a docset for this codebase
    DocsetApi.Builder.build("MyApp", "docs/exdoc", path)

    # generate docsets for every dependency
    configured_deps = Enum.map(MoodleNet.Mixfile.deps(), &dep_process(&1, path))

  end

  defp dep_process(dep, path) do
    lib = elem(dep, 0)

    DocsetApi.Builder.build(Atom.to_string(lib), path)

  end

  def run(_args),
    do:
      Mix.shell().error("""
      Invalid parameters.

      Usage:

        #{@usage}
      """)
end

Then run the task mix moodle_net.generate_docsets /home/myuser/.local/share/Zeal/Zeal/docsets/ with your desired output directory.

Voila!

Screenshot

hexdocs_docset_api's People

Contributors

andrhua avatar awea avatar hissssst avatar j3rn avatar johnhamelink avatar mayel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

hexdocs_docset_api's Issues

Release build jason not listed in release boot

error: builder for '/nix/store/r4mp54068j5ckll9rc4ss15izb9aicrw-hexdocs_docset_api-1.0.0.drv' failed with exit code 1;
       last 10 log lines:
       > * assembling docset_api-0.1.0 on MIX_ENV=prod
       > * using config/runtime.exs to configure the release at runtime
       > ** (Mix.Error) Application :phoenix is listed in the release boot, but it depends on :jason, which isn't
       >     (mix 1.14.5) lib/mix.ex:513: Mix.raise/2
       >     (mix 1.14.5) lib/mix/tasks/release.ex:1108: Mix.Tasks.Release.assemble/1
       >     (mix 1.14.5) lib/mix/tasks/release.ex:1084: Mix.Tasks.Release.run_steps/1
       >     (mix 1.14.5) lib/mix/task.ex:421: anonymous fn/3 in Mix.Task.run_task/4
       >     (stdlib 3.17.2.4) timer.erl:166: :timer.tc/1
       >     (mix 1.14.5) lib/mix/task.ex:444: Mix.Task.with_debug/4
       >     (mix 1.14.5) lib/mix/cli.ex:84: Mix.CLI.run_task/2
       For full logs, run 'nix log /nix/store/r4mp54068j5ckll9rc4ss15izb9aicrw-hexdocs_docset_api-1.0.0.drv'.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.