Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Build Status](https://github.com/elixir-lang/ex_doc/workflows/CI/badge.svg)](https://github.com/elixir-lang/ex_doc/actions?query=workflow%3A%22CI%22)

ExDoc is a tool to generate documentation for Erlang and Elixir projects. To see an example, [you can access Elixir's official docs](https://hexdocs.pm/elixir/).
ExDoc is a tool to generate documentation for Erlang and Elixir projects. To see an example, [you can access Elixir's official docs](https://elixir.hexdocs.pm/).

## Features

Expand Down Expand Up @@ -75,7 +75,7 @@ end

Now you are ready to generate your project documentation with `mix docs`. To see all options available, run `mix help docs`.

To learn about how to document your projects, see [Elixir's writing documentation page](https://hexdocs.pm/elixir/writing-documentation.html).
To learn about how to document your projects, see [Elixir's writing documentation page](https://elixir.hexdocs.pm/writing-documentation.html).

### Rebar3

Expand Down Expand Up @@ -154,7 +154,7 @@ You can publish additional pages in your project documentation by configuring th

* Markdown (`.md` extension) - useful for general long-term text. [Learn more](https://daringfireball.net/projects/markdown/syntax).

* Cheatsheets (`.cheatmd` extension) - useful for discovery and quick reference. [Learn more](https://hexdocs.pm/ex_doc/cheatsheet.html).
* Cheatsheets (`.cheatmd` extension) - useful for discovery and quick reference. [Learn more](https://ex-doc.hexdocs.pm/cheatsheet.html).

* Livebooks (`.livemd` extension) - useful for tutorials, interactive examples, and deep dives. [Learn more](https://livebook.dev/).

Expand Down Expand Up @@ -233,13 +233,13 @@ ExDoc supports linking to modules (`` `MyModule` `` and `` `m:MyModule` ``), fun

You can also use custom text, such as `` [custom text](`MyModule.function/1`) ``. Link to extra pages using the syntax `` [Up and running](Up and running.md) ``. The final link will be automatically converted to `up-and-running.html`.

Link to extra pages in another application using the syntax `` [Writing Documentation](`e:elixir:writing-documentation.html`) ``, skipping the directory in which the page is. The final link will be automatically converted to `https://hexdocs.pm/elixir/writing-documentation.html`.
Link to extra pages in another application using the syntax `` [Writing Documentation](`e:elixir:writing-documentation.html`) ``, skipping the directory in which the page is. The final link will be automatically converted to `https://elixir.hexdocs.pm/writing-documentation.html`.

It is also possible to place anchors after the module name and extra pages. For example:

* `` `m:Keyword#module-duplicate-keys-and-ordering` `` will create a link to `https://hexdocs.pm/elixir/Keyword.html#module-duplicate-keys-and-ordering`
* `` `m:Keyword#module-duplicate-keys-and-ordering` `` will create a link to `https://elixir.hexdocs.pm/Keyword.html#module-duplicate-keys-and-ordering`

* `` `e:elixir:syntax-reference.md#expressions` `` will create a link to `https://hexdocs.pm/elixir/syntax-reference.html#expressions`
* `` `e:elixir:syntax-reference.md#expressions` `` will create a link to `https://elixir.hexdocs.pm/syntax-reference.html#expressions`

### Erlang

Expand All @@ -251,13 +251,13 @@ You can also use custom text, such as `` [custom text](`my_module:function/1`) `

Link to extra pages using the syntax `` [Up and running](Up and running.md) ``. The final link will be automatically converted to `up-and-running.html`.

Link to extra pages in another application using the syntax `` [Using unicode](`e:stdlib:unicode_usage.html`) ``, skipping the directory in which the page is. The final link will be automatically converted to `https://hexdocs.pm/elixir/writing-documentation.html`.
Link to extra pages in another application using the syntax `` [Using unicode](`e:stdlib:unicode_usage.html`) ``, skipping the directory in which the page is. The final link will be automatically converted to `https://www.erlang.org/doc/apps/stdlib/unicode_usage.html`.

It is also possible to place anchors after the module name and extra pages. For example:

* `` `m:argparse#quick-start` `` will create a link to `https://erlang.org/doc/man/argparse#quick-start`
* `` `m:argparse#module-quick-start` `` will create a link to `https://www.erlang.org/doc/apps/stdlib/argparse.html#module-quick-start`

* `` `e:stdlib:unicode-usage.md#what-unicode-is` `` will create a link to `https://erlang.org/doc/apps/stdlib/unicode-usage.html#what-unicode-is`
* `` `e:stdlib:unicode_usage.md#what-unicode-is` `` will create a link to `https://www.erlang.org/doc/apps/stdlib/unicode_usage.html#what-unicode-is`

<!-- tabs-close -->

Expand Down
6 changes: 3 additions & 3 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ defmodule ExDoc.Mixfile do
files: ~w(CHANGELOG.md Cheatsheet.cheatmd formatters lib LICENSE mix.exs README.md),
links: %{
"GitHub" => @source_url,
"Changelog" => "https://hexdocs.pm/ex_doc/changelog.html",
"Writing documentation" => "https://hexdocs.pm/elixir/writing-documentation.html"
"Changelog" => "https://ex-doc.hexdocs.pm/changelog.html",
"Writing documentation" => "https://elixir.hexdocs.pm/writing-documentation.html"
}
]
end
Expand Down Expand Up @@ -149,7 +149,7 @@ defmodule ExDoc.Mixfile do
list_contents =
Enum.map_intersperse(versions, ", ", fn version ->
string = Version.to_string(version)
~s[{"version":"v#{string}", "url":"https://hexdocs.pm/ex_doc/#{string}"}]
~s[{"version":"v#{string}", "url":"https://ex-doc.hexdocs.pm/#{string}"}]
end)

File.write!("doc/docs_config.js", """
Expand Down
3 changes: 3 additions & 0 deletions test/ex_doc/formatter/html/templates_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ defmodule ExDoc.Formatter.HTML.TemplatesTest do
assert render_doc("[docs](https://hexdocs.pm/ex_doc)") ==
~s|<p><a href="https://hexdocs.pm/ex_doc">docs</a></p>|

assert render_doc("[docs](https://ex-doc.hexdocs.pm)") ==
~s|<p><a href="https://ex-doc.hexdocs.pm">docs</a></p>|

assert render_doc("[elixir](https://elixir-lang.org)") ==
~s|<p><a href="https://elixir-lang.org">elixir</a></p>|

Expand Down
6 changes: 3 additions & 3 deletions test/ex_doc/formatter/html_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -338,15 +338,15 @@ defmodule ExDoc.Formatter.HTMLTest do
config(context,
source_beam: "unknown",
extras: ["test/fixtures/README.md"],
canonical: "https://hexdocs.pm/elixir/"
canonical: "https://example.com"
)

generate(config)
content = File.read!(tmp_dir <> "/html/api-reference.html")
assert content =~ ~r{<link rel="canonical" href="https://hexdocs.pm/elixir/}
assert content =~ ~r{<link rel="canonical" href="https://example.com/}

content = File.read!(tmp_dir <> "/html/readme.html")
assert content =~ ~r{<link rel="canonical" href="https://hexdocs.pm/elixir/}
assert content =~ ~r{<link rel="canonical" href="https://example.com/}
end

test "is not included when canonical is nil", %{tmp_dir: tmp_dir} = context do
Expand Down
Loading