Coder Social home page Coder Social logo

rebar3_ex_doc's Introduction

rebar3_ex_doc

Build Status Erlang/OTP Version Hex Version Hex Docs Total Download License Last Updated

rebar3_ex_doc is a rebar3 plugin to generate documentation using ex_doc. This plugin ships with ex_doc as an escript, thus you don't need to worry about having Elixir installed nor compiling the ex_doc dependencies.

Screenshot of rebar3_ex_doc

This plugin can be used to generate documentation on its own and also integrates with rebar3_hex for publishing documentation to go along with your packages on hex.pm.

Installation

NOTE: This plugin and more importantly ex_doc depend on edocs capability to generate beam chunks per EEP-48. Thus, the minimum OTP version supported by this plugin is Erlang/OTP 24.

As a global plugin

Simply add rebar3_ex_doc to the plugins section in your global rebar3.config:

{plugins, [rebar3_ex_doc]}.

In your rebar3 project

You can add this plugin to your rebar3 project as a project plugin, like so:

{project_plugins, [rebar3_ex_doc]}.

Setup

This plugin should work out of the box, but the following configuration is recommended when publishing documentation to hex.pm.

Simply add the configuration below to your rebar.config and adjust for your project:

{ex_doc, [
     {extras, ["README.md", "LICENSE"]},
     {main, "README.md"},
     {source_url, "https://github.com/namespace/your_app"}
]}.

For further customization, see the configuration for rebar3_ex_doc:

{ex_doc, [
    {extras, [
          {"CHANGELOG.md", #{title => "Changelog"}},
          {"README.md", #{title => "Overview"}},
          {"LICENSE.md", #{title => "License"}}
    ]},
    {main, "README.md"},
    {homepage_url, "https://github.com/starbelly/rebar3_ex_doc"},
    {source_url, "https://github.com/starbelly/rebar3_ex_doc"},
    {assets, "assets"},
    {api_reference, false}
]}.

Please see the ex_doc configuration documentation for a complete overview of available configuration directives.

Umbrella support

Umbrellas are supported but they must be configured on an app by app basis. This is to avoid publishing documentation to Hex.pm with wrong source urls, logos, etc.

Specifically, for each app you wish to generate documentation for, and more importantly publish to hex.pm, you should place a rebar.config in each app directory with the desired configuration for that application.

Usage

After the plugin has been added to your project you can simplly run rebar3 ex_doc to generate your docs and view them in your favorite browser.

Run rebar3 help ex_doc to see all available options.

Integrating with rebar3_hex

We highly recommend using rebar3_ex_doc as the documentation provider for all your hex projects to provide the users of our ecosystem with a consistent documentation format and style.

To integrate with rebar3_hex merely specify rebar3_ex_doc as the doc provider in your projects hex configuration in rebar.config :

{hex, [
    {doc, #{provider => ex_doc}}
]}.

Supported options

Not all ex_doc options are supported. This means we'll warn on unknown options, but still pass them to ex_doc. We try to make sure the supported options are converted to the format known by ex_doc. In case you get a warning for something that is working or would like further conversion support, open a GitHub issue.

Development

If you'd like to hack on this plugin, follow the steps below:

  1. You must have at least Elixir 1.13.0 installed to build the ex_doc escript.

  2. Make a new rebar project or go into an existing project:

    $ rebar3 new myapp
    $ cd myapp
  3. Make a _checkouts directory:

    $ mkdir _checkouts
  4. Go to _checkouts and clone this repository to create a checkout dependency:

    $ cd _checkouts
    $ git clone https://github.com/starbelly/rebar3_ex_doc
  5. Get all dependencies and build the ex_doc console app:

    $ cd rebar3_ex_doc
    $ mix deps.get
    $ mix escript.build
  6. Go back to the root of your project:

    $ cd ../..
  7. Add rebar3_ex_doc as plugin to your rebar.config:

    {project_plugins, [rebar3_ex_doc]}.
  8. Generate documentation as an initial test:

    $ rebar3 ex_doc

Copyright and License

Copyright 2021, Bryan Paxton [email protected].

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

rebar3_ex_doc's People

Contributors

starbelly avatar paulo-ferraz-oliveira avatar kianmeng avatar weiss avatar

Watchers

 avatar

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.