diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 545f72de0a7..9a3b348314a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -135,7 +135,7 @@ make docs This will produce documentation sets for `elixir`, `eex`, `ex_unit`, `iex`, `logger`, and `mix` under the `doc` directory. If you are planning to contribute documentation, -[please check our best practices for writing documentation](https://hexdocs.pm/elixir/writing-documentation.html). +[please check our best practices for writing documentation](https://elixir.hexdocs.pm/writing-documentation.html). ## Licensing and Compliance Requirements diff --git a/Makefile b/Makefile index 417aec2ed34..e96fb58e690 100644 --- a/Makefile +++ b/Makefile @@ -189,7 +189,7 @@ clean_elixir: #==> Documentation tasks SOURCE_REF = $(shell tag="$(call GIT_TAG)" revision="$(call GIT_REVISION)"; echo "$${tag:-$$revision}") -DOCS_COMPILE = CANONICAL=$(CANONICAL) bin/elixir ../ex_doc/bin/ex_doc "$(1)" "$(VERSION)" "lib/$(2)/ebin" --main "$(3)" --source-url "https://github.com/elixir-lang/elixir" --source-ref "$(call SOURCE_REF)" --logo lib/elixir/pages/images/logo.png --output doc/$(2) --canonical "https://hexdocs.pm/$(2)/$(CANONICAL)" --homepage-url "https://elixir-lang.org/docs.html" $(DOCS_OPTIONS) $(4) +DOCS_COMPILE = CANONICAL=$(CANONICAL) bin/elixir ../ex_doc/bin/ex_doc "$(1)" "$(VERSION)" "lib/$(2)/ebin" --main "$(3)" --source-url "https://github.com/elixir-lang/elixir" --source-ref "$(call SOURCE_REF)" --logo lib/elixir/pages/images/logo.png --output doc/$(2) --canonical "https://$(2).hexdocs.pm/$(CANONICAL)" --homepage-url "https://elixir-lang.org/docs.html" $(DOCS_OPTIONS) $(4) DOCS_CONFIG = bin/elixir lib/elixir/scripts/docs_config.exs "$(1)" docs: compile ../ex_doc/bin/ex_doc docs_elixir docs_eex docs_mix docs_iex docs_ex_unit docs_logger diff --git a/lib/elixir/lib/gen_event.ex b/lib/elixir/lib/gen_event.ex index 4763739a8f3..72f9f435aa1 100644 --- a/lib/elixir/lib/gen_event.ex +++ b/lib/elixir/lib/gen_event.ex @@ -36,7 +36,7 @@ defmodule GenEvent do alternative. GenStage is an external Elixir library maintained by the Elixir team; it provides a tool to implement systems that exchange events in a demand-driven way with built-in support for back-pressure. See the [GenStage - documentation](https://hexdocs.pm/gen_stage) for more information. + documentation](https://gen-stage.hexdocs.pm) for more information. ### `:gen_event` diff --git a/lib/elixir/lib/kernel.ex b/lib/elixir/lib/kernel.ex index a6aea9008a3..0a9e1a9c414 100644 --- a/lib/elixir/lib/kernel.ex +++ b/lib/elixir/lib/kernel.ex @@ -6278,7 +6278,7 @@ defmodule Kernel do step through the code it sees). For general stepping, you can set breakpoints using `IEx.break!/4`. - For more information, [see IEx documentation](https://hexdocs.pm/iex/IEx.html#module-dbg-and-breakpoints). + For more information, [see IEx documentation](https://iex.hexdocs.pm/IEx.html#module-dbg-and-breakpoints). ## Configuring the debug function @@ -7051,7 +7051,7 @@ defmodule Kernel do :guard -> raise ArgumentError, "invalid expression in guard, #{exp} is not allowed in guards. " <> - "To learn more about guards, visit: https://hexdocs.pm/elixir/patterns-and-guards.html" + "To learn more about guards, visit: https://elixir.hexdocs.pm/patterns-and-guards.html" _ -> :ok diff --git a/lib/elixir/lib/macro.ex b/lib/elixir/lib/macro.ex index 5d957d074f0..297f709a992 100644 --- a/lib/elixir/lib/macro.ex +++ b/lib/elixir/lib/macro.ex @@ -2699,7 +2699,7 @@ defmodule Macro do :guard -> raise ArgumentError, "invalid expression in guard, dbg is not allowed in guards. " <> - "To learn more about guards, visit: https://hexdocs.pm/elixir/patterns-and-guards.html" + "To learn more about guards, visit: https://elixir.hexdocs.pm/patterns-and-guards.html" _ -> :ok diff --git a/lib/elixir/lib/module.ex b/lib/elixir/lib/module.ex index 5ed7d7fcb00..40c88ef2252 100644 --- a/lib/elixir/lib/module.ex +++ b/lib/elixir/lib/module.ex @@ -190,7 +190,7 @@ defmodule Module do * a string (often a heredoc) * `false`, which will make the entity invisible to documentation-extraction - tools like [`ExDoc`](https://hexdocs.pm/ex_doc/) + tools like [`ExDoc`](https://ex-doc.hexdocs.pm/) * a keyword list, since Elixir 1.7.0 For example: @@ -216,7 +216,7 @@ defmodule Module do As can be seen in the example above, since Elixir 1.7.0 `@doc` and `@typedoc` also accept a keyword list that serves as a way to provide arbitrary metadata - about the entity. Tools like [`ExDoc`](https://hexdocs.pm/ex_doc/) and + about the entity. Tools like [`ExDoc`](https://ex-doc.hexdocs.pm/) and `IEx` may use this information to display annotations. A common use case is the `:since` key, which may be used to annotate in which version the function was introduced. @@ -263,7 +263,7 @@ defmodule Module do Tools may use this information to ensure the module is recompiled in case any of the external resources change, see for example: - [`mix compile.elixir`](https://hexdocs.pm/mix/Mix.Tasks.Compile.Elixir.html). + [`mix compile.elixir`](https://mix.hexdocs.pm/Mix.Tasks.Compile.Elixir.html). The specified file path provided is interpreted as relative to the folder containing the project's `mix.exs`, which is the @@ -321,7 +321,7 @@ defmodule Module do Accepts a string (often a heredoc) or `false` where `@moduledoc false` will make the module invisible to documentation extraction tools like - [`ExDoc`](https://hexdocs.pm/ex_doc/). + [`ExDoc`](https://ex-doc.hexdocs.pm/). Similarly to `@doc` also accepts a keyword list to provide metadata about the module. For more details, see the documentation of `@doc` diff --git a/lib/elixir/pages/anti-patterns/design-anti-patterns.md b/lib/elixir/pages/anti-patterns/design-anti-patterns.md index 6e0d6dfa30e..7d45a4983f2 100644 --- a/lib/elixir/pages/anti-patterns/design-anti-patterns.md +++ b/lib/elixir/pages/anti-patterns/design-anti-patterns.md @@ -226,7 +226,7 @@ end While you may receive the `address` as a string from a database, web request, or a third-party, if you find yourself frequently manipulating or extracting information from the string, it is a good indicator you should convert the address into structured data: -Another example of this anti-pattern is using floating numbers to model money and currency, when [richer data structures should be preferred](https://hexdocs.pm/ex_money/). +Another example of this anti-pattern is using floating numbers to model money and currency, when [richer data structures should be preferred](https://ex-money.hexdocs.pm/). #### Refactoring @@ -350,7 +350,7 @@ The difference here is that the `struct/2` function behaves precisely the same f #### Problem -The [*application environment*](https://hexdocs.pm/elixir/Application.html#module-the-application-environment) can be used to parameterize global values that can be used in an Elixir system. This mechanism can be very useful and therefore is not considered an anti-pattern by itself. However, library authors should avoid using the application environment to configure their library. The reason is exactly that the application environment is a **global** state, so there can only be a single value for each key in the environment for an application. This makes it impossible for multiple applications depending on the same library to configure the same aspect of the library in different ways. +The [*application environment*](https://elixir.hexdocs.pm/Application.html#module-the-application-environment) can be used to parameterize global values that can be used in an Elixir system. This mechanism can be very useful and therefore is not considered an anti-pattern by itself. However, library authors should avoid using the application environment to configure their library. The reason is exactly that the application environment is a **global** state, so there can only be a single value for each key in the environment for an application. This makes it impossible for multiple applications depending on the same library to configure the same aspect of the library in different ways. #### Example diff --git a/lib/elixir/pages/references/sbom.md b/lib/elixir/pages/references/sbom.md index d37ba179446..86a72ab1f9d 100644 --- a/lib/elixir/pages/references/sbom.md +++ b/lib/elixir/pages/references/sbom.md @@ -146,4 +146,4 @@ See the [ORT Mix plugin documentation](https://oss-review-toolkit.org/ort/docs/p * [CycloneDX Specification](https://cyclonedx.org/specification/overview/): learn more about the SBoM format * [OWASP Dependency-Track](https://dependencytrack.org/): continuous SBoM analysis platform - * [mix_sbom documentation](https://hexdocs.pm/sbom): full documentation and advanced options + * [mix_sbom documentation](https://sbom.hexdocs.pm): full documentation and advanced options diff --git a/lib/elixir/pages/references/typespecs.md b/lib/elixir/pages/references/typespecs.md index 32ff5ad12eb..87b47af8c2f 100644 --- a/lib/elixir/pages/references/typespecs.md +++ b/lib/elixir/pages/references/typespecs.md @@ -16,7 +16,7 @@ Elixir is a dynamically typed language, and as such, type specifications are never used by the compiler to optimize or modify code. Still, using type specifications is useful because: - * they provide documentation (for example, tools such as [`ExDoc`](https://hexdocs.pm/ex_doc/) show type specifications in the documentation) + * they provide documentation (for example, tools such as [`ExDoc`](https://ex-doc.hexdocs.pm/) show type specifications in the documentation) * they're used by tools such as [Dialyzer](`:dialyzer`), that can analyze code with typespecs to find type inconsistencies and possible bugs Type specifications (most often referred to as *typespecs*) are defined in different contexts using the following attributes: diff --git a/lib/elixir/pages/references/unicode-syntax.md b/lib/elixir/pages/references/unicode-syntax.md index c700590e3c5..26443098dcf 100644 --- a/lib/elixir/pages/references/unicode-syntax.md +++ b/lib/elixir/pages/references/unicode-syntax.md @@ -37,7 +37,7 @@ Mixed-script identifiers are not supported for security reasons. 'аdmin' is mad \u006E n {Latin} Make sure all characters in the identifier resolve to a single script or a highly -restrictive script. See https://hexdocs.pm/elixir/unicode-syntax.html for more information. +restrictive script. See https://elixir.hexdocs.pm/unicode-syntax.html for more information. ``` Finally, Elixir will also warn of confusable identifiers in the same file. For example, Elixir will emit a warning if you use both variables `а` (Cyrillic) and `а` (Latin) in your code. diff --git a/lib/elixir/scripts/docs_config.exs b/lib/elixir/scripts/docs_config.exs index 4e9a35254ff..db41f1fa967 100644 --- a/lib/elixir/scripts/docs_config.exs +++ b/lib/elixir/scripts/docs_config.exs @@ -42,7 +42,11 @@ latest = version_nodes = for version <- versions do version_string = Version.to_string(version) - map = %{version: "v#{version_string}", url: "https://hexdocs.pm/#{app}/#{version_string}"} + + map = %{ + version: "v#{version_string}", + url: "https://#{String.replace(app, "_", "-")}.hexdocs.pm/#{version_string}" + } if version_string == latest do Map.put(map, :latest, true) diff --git a/lib/elixir/scripts/elixir_docs.exs b/lib/elixir/scripts/elixir_docs.exs index 515635a9527..4a298c5947a 100644 --- a/lib/elixir/scripts/elixir_docs.exs +++ b/lib/elixir/scripts/elixir_docs.exs @@ -79,11 +79,11 @@ canonical = System.fetch_env!("CANONICAL") "CHANGELOG.md" ], deps: [ - eex: "https://hexdocs.pm/eex/#{canonical}", - ex_unit: "https://hexdocs.pm/ex_unit/#{canonical}", - iex: "https://hexdocs.pm/iex/#{canonical}", - logger: "https://hexdocs.pm/logger/#{canonical}", - mix: "https://hexdocs.pm/mix/#{canonical}" + eex: "https://eex.hexdocs.pm/#{canonical}", + ex_unit: "https://ex-unit.hexdocs.pm/#{canonical}", + iex: "https://iex.hexdocs.pm/#{canonical}", + logger: "https://logger.hexdocs.pm/#{canonical}", + mix: "https://mix.hexdocs.pm/#{canonical}" ], groups_for_extras: [ "Getting started": ~r"pages/getting-started/.*\.md$", diff --git a/lib/elixir/scripts/mix_docs.exs b/lib/elixir/scripts/mix_docs.exs index bed7f14e700..08b92efc9a9 100644 --- a/lib/elixir/scripts/mix_docs.exs +++ b/lib/elixir/scripts/mix_docs.exs @@ -21,12 +21,12 @@ canonical = System.fetch_env!("CANONICAL") } ], deps: [ - eex: "https://hexdocs.pm/eex/#{canonical}", - elixir: "https://hexdocs.pm/elixir/#{canonical}", - ex_unit: "https://hexdocs.pm/ex_unit/#{canonical}", - iex: "https://hexdocs.pm/iex/#{canonical}", - logger: "https://hexdocs.pm/logger/#{canonical}", - mix: "https://hexdocs.pm/mix/#{canonical}" + eex: "https://eex.hexdocs.pm/#{canonical}", + elixir: "https://elixir.hexdocs.pm/#{canonical}", + ex_unit: "https://ex-unit.hexdocs.pm/#{canonical}", + iex: "https://iex.hexdocs.pm/#{canonical}", + logger: "https://logger.hexdocs.pm/#{canonical}", + mix: "https://mix.hexdocs.pm/#{canonical}" ], formatters: ["html", "markdown", "epub"], before_closing_body_tag: fn diff --git a/lib/elixir/src/elixir_expand.erl b/lib/elixir/src/elixir_expand.erl index 4b8937fb404..97e72d52da8 100644 --- a/lib/elixir/src/elixir_expand.erl +++ b/lib/elixir/src/elixir_expand.erl @@ -1248,12 +1248,12 @@ format_error({invalid_expr_in_scope, Scope, Kind}) -> format_error({invalid_expr_in_guard, Kind}) -> Message = "invalid expression in guards, ~ts is not allowed in guards. To learn more about " - "guards, visit: https://hexdocs.pm/elixir/patterns-and-guards.html#guards", + "guards, visit: https://elixir.hexdocs.pm/patterns-and-guards.html#guards", io_lib:format(Message, [Kind]); format_error({invalid_expr_in_bitsize, Kind}) -> Message = "~ts is not allowed inside a bitstring size specifier. The size specifier in matches works like guards. " - "To learn more about guards, visit: https://hexdocs.pm/elixir/patterns-and-guards.html#guards", + "To learn more about guards, visit: https://elixir.hexdocs.pm/patterns-and-guards.html#guards", io_lib:format(Message, [Kind]); format_error({invalid_alias, Expr}) -> Message = diff --git a/lib/elixir/src/elixir_tokenizer.erl b/lib/elixir/src/elixir_tokenizer.erl index 6592aed98ce..92c46b768ef 100644 --- a/lib/elixir/src/elixir_tokenizer.erl +++ b/lib/elixir/src/elixir_tokenizer.erl @@ -1406,7 +1406,7 @@ tokenize_identifier(String, Line, Column, Scope, MaybeKeyword) -> case suggest_simpler_unexpected_token_in_error(Wrong, Line, WrongColumn, Scope) of no_suggestion -> %% we append a pointer to more info if we aren't appending a suggestion - MoreInfo = "\nSee https://hexdocs.pm/elixir/unicode-syntax.html for more information.", + MoreInfo = "\nSee https://elixir.hexdocs.pm/unicode-syntax.html for more information.", {error, {?LOC(Line, Column), {Prefix, Suffix ++ MoreInfo}, Wrong}}; {_, {Location, _, SuggestionMessage}} = _SuggestionError -> @@ -1443,7 +1443,7 @@ suggest_simpler_unexpected_token_in_error(Wrong, Line, WrongColumn, Scope) -> Wrong, "You could write the above in a similar way that is accepted by Elixir:", Simpler, - "See https://hexdocs.pm/elixir/unicode-syntax.html for more information."), + "See https://elixir.hexdocs.pm/unicode-syntax.html for more information."), {error, {?LOC(Line, WrongColumn), "unexpected token: ", Message}}; _other -> no_suggestion @@ -1453,7 +1453,7 @@ suggest_simpler_unexpected_token_in_error(Wrong, Line, WrongColumn, Scope) -> Wrong, "You could write the above in a compatible format that is accepted by Elixir:", NFKC, - "See https://hexdocs.pm/elixir/unicode-syntax.html for more information."), + "See https://elixir.hexdocs.pm/unicode-syntax.html for more information."), {error, {?LOC(Line, WrongColumn), "unexpected token: ", Message}} end. diff --git a/lib/elixir/test/elixir/kernel/parser_test.exs b/lib/elixir/test/elixir/kernel/parser_test.exs index bf37abb5d28..a2d8f43bb45 100644 --- a/lib/elixir/test/elixir/kernel/parser_test.exs +++ b/lib/elixir/test/elixir/kernel/parser_test.exs @@ -1332,7 +1332,7 @@ defmodule Kernel.ParserTest do ~s/"foO𝚳" (code points 0x00066 0x0006F 0x0004F 0x1D6B3)/, "Hint: You could write the above in a similar way that is accepted by Elixir:", ~s/"foOM" (code points 0x00066 0x0006F 0x0004F 0x0004D)/, - "See https://hexdocs.pm/elixir/unicode-syntax.html for more information." + "See https://elixir.hexdocs.pm/unicode-syntax.html for more information." ] assert_syntax_error(message, ~c"foO𝚳") @@ -1349,7 +1349,7 @@ defmodule Kernel.ParserTest do ~s/"𝚳" (code points 0x1D6B3)/, "Hint: You could write the above in a compatible format that is accepted by Elixir:", ~s/"Μ" (code points 0x0039C)/, - "See https://hexdocs.pm/elixir/unicode-syntax.html for more information." + "See https://elixir.hexdocs.pm/unicode-syntax.html for more information." ] assert_syntax_error(message, ~c"fooی𝚳") diff --git a/lib/mix/lib/mix.ex b/lib/mix/lib/mix.ex index c7083f9b55b..ec9e9a116ff 100644 --- a/lib/mix/lib/mix.ex +++ b/lib/mix/lib/mix.ex @@ -155,7 +155,7 @@ defmodule Mix do > #### Avoiding the application environment {: .warning} > > The application environment is discouraged for libraries. See Elixir's - > [Library Guidelines](https://hexdocs.pm/elixir/library-guidelines.html) for + > [Library Guidelines](https://elixir.hexdocs.pm/library-guidelines.html) for > more information. ### Build-time configuration @@ -398,7 +398,7 @@ defmodule Mix do If you simply want to change the certificates used by Mix and Hex, you may set the `HEX_CACERTS_PATH` environment variable, pointing to a CA certificate file. - See [`mix hex.config`](https://hexdocs.pm/hex/Mix.Tasks.Hex.Config.html#module-config-keys). + See [`mix hex.config`](https://hex.hexdocs.pm/Mix.Tasks.Hex.Config.html#module-config-keys). From Erlang/OTP 27.2, it is also possible to change the certificates for your project as a whole. To do so, you might add the following to your `config/config.exs`: diff --git a/lib/mix/lib/mix/task.ex b/lib/mix/lib/mix/task.ex index b0950168f2d..da21368cac6 100644 --- a/lib/mix/lib/mix/task.ex +++ b/lib/mix/lib/mix/task.ex @@ -304,7 +304,7 @@ defmodule Mix.Task do Returns `false` if the given name is not an alias or if it is not a task. For more information about task aliasing, take a look at the - ["Aliases"](https://hexdocs.pm/mix/Mix.html#module-aliases) section in the + ["Aliases"](https://mix.hexdocs.pm/Mix.html#module-aliases) section in the docs for `Mix`. """ @spec alias?(task_name) :: boolean diff --git a/lib/mix/lib/mix/tasks/new.ex b/lib/mix/lib/mix/tasks/new.ex index 63a5d167492..8cdf7ff9aab 100644 --- a/lib/mix/lib/mix/tasks/new.ex +++ b/lib/mix/lib/mix/tasks/new.ex @@ -286,7 +286,7 @@ defmodule Mix.Tasks.New do Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc) and published on [HexDocs](https://hexdocs.pm). Once published, the docs can - be found at >. + be found at .hexdocs.pm>. <% end %> """) @@ -469,7 +469,7 @@ defmodule Mix.Tasks.New do embed_template(:lib_app, """ defmodule <%= @mod %>.Application do - # See https://hexdocs.pm/elixir/Application.html + # See https://elixir.hexdocs.pm/Application.html # for more information on OTP Applications @moduledoc false @@ -482,7 +482,7 @@ defmodule Mix.Tasks.New do # {<%= @mod %>.Worker, arg} ] - # See https://hexdocs.pm/elixir/Supervisor.html + # See https://elixir.hexdocs.pm/Supervisor.html # for other strategies and supported options opts = [strategy: :one_for_one, name: <%= @mod %>.Supervisor] Supervisor.start_link(children, opts)