From fba8953eaa5f1884dd4820db1cfaf95212db812e Mon Sep 17 00:00:00 2001 From: Rodolfo Carvalho Date: Mon, 12 Oct 2026 13:43:23 +0200 Subject: [PATCH] Fix links to hexdocs and erlang.org Follows up on 4c269a64, updating remaining links from hexdocs.pm/package to package.hexdocs.pm in README.md, ExDoc own metadata and JS config links. Fixes broken Erlang documentation in README.md. Follows up on 3695017e, adding a test to the nofollow feature matching the new hexdocs URL pattern in addition to the old one. Updates the canonical link test to use a neutral example URL since it doesn't depend on hexdocs. --- README.md | 18 +++++++++--------- mix.exs | 6 +++--- test/ex_doc/formatter/html/templates_test.exs | 3 +++ test/ex_doc/formatter/html_test.exs | 6 +++--- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index ea12cd1ed..a444a9776 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 @@ -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/). @@ -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 @@ -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` diff --git a/mix.exs b/mix.exs index 8a2577366..d3ba0ffad 100644 --- a/mix.exs +++ b/mix.exs @@ -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 @@ -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", """ diff --git a/test/ex_doc/formatter/html/templates_test.exs b/test/ex_doc/formatter/html/templates_test.exs index 1458b35bb..f7c6f66a3 100644 --- a/test/ex_doc/formatter/html/templates_test.exs +++ b/test/ex_doc/formatter/html/templates_test.exs @@ -98,6 +98,9 @@ defmodule ExDoc.Formatter.HTML.TemplatesTest do assert render_doc("[docs](https://hexdocs.pm/ex_doc)") == ~s|

docs

| + assert render_doc("[docs](https://ex-doc.hexdocs.pm)") == + ~s|

docs

| + assert render_doc("[elixir](https://elixir-lang.org)") == ~s|

elixir

| diff --git a/test/ex_doc/formatter/html_test.exs b/test/ex_doc/formatter/html_test.exs index a49d15f68..d08fe964a 100644 --- a/test/ex_doc/formatter/html_test.exs +++ b/test/ex_doc/formatter/html_test.exs @@ -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{