Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "Using ExDoc with Erlang projects" to README #1378

Merged
merged 3 commits into from
Jul 4, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,51 @@ For example, here are some acceptable values:
GITHUB_USER => elixir-lang
GITHUB_REPO => ecto

## Using ExDoc with Erlang projects

To use ExDoc with Erlang projects you need to do the following:

1. Use OTP 24+
wojtekmach marked this conversation as resolved.
Show resolved Hide resolved

2. Add the following to your `rebar.config`. This instructs `edoc` to generate doc chunks
instead of HTML docs:

```erlang
{edoc_opts, [
{doclet, edoc_doclet_chunks},
{layout, edoc_layout_chunks},
{dir, "_build/default/lib/<app>/doc"}]}.
```

Replace `<app>` with the name of your app.

3. Install ExDoc escript:

```bash
$ mix escript.install github elixir-lang/ex_doc
```

4. Generate docs:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to say that, if the escript path is not in their system paths, they will need to point to it directly.


```bash
$ rebar3 edoc
$ ex_doc "PROJECT_NAME" "PROJECT_VERSION" _build/default/lib/<app>/ebin
```

5. If you're publishing docs to Hex.pm with `rebar3 hex docs`, first add the following to your `src/<app>.app.src`:

```erlang
{doc, "doc"}
```

This instructs rebar3 to get HTML docs from the directory "doc" and that's where ExDoc would generate the docs by default.

Now you can publish your docs:

```bash
$ rebar3 hex docs
```

## Auto-linking

ExDoc will automatically generate links across modules and functions if you enclose them in backticks:
Expand Down