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
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/elixir/lib/gen_event.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
4 changes: 2 additions & 2 deletions lib/elixir/lib/kernel.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/elixir/lib/macro.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions lib/elixir/lib/module.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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`
Expand Down
4 changes: 2 additions & 2 deletions lib/elixir/pages/anti-patterns/design-anti-patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/elixir/pages/references/sbom.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion lib/elixir/pages/references/typespecs.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion lib/elixir/pages/references/unicode-syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 5 additions & 1 deletion lib/elixir/scripts/docs_config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions lib/elixir/scripts/elixir_docs.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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$",
Expand Down
12 changes: 6 additions & 6 deletions lib/elixir/scripts/mix_docs.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/elixir/src/elixir_expand.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
6 changes: 3 additions & 3 deletions lib/elixir/src/elixir_tokenizer.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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 ->
Expand Down Expand Up @@ -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
Expand All @@ -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.

Expand Down
4 changes: 2 additions & 2 deletions lib/elixir/test/elixir/kernel/parser_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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𝚳")
Expand All @@ -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ی𝚳")
Expand Down
4 changes: 2 additions & 2 deletions lib/mix/lib/mix.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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`:
Expand Down
2 changes: 1 addition & 1 deletion lib/mix/lib/mix/task.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions lib/mix/lib/mix/tasks/new.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://hexdocs.pm/<%= @app %>>.
be found at <https://<%= String.replace(@app, "_", "-") %>.hexdocs.pm>.
<% end %>
""")

Expand Down Expand Up @@ -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

Expand All @@ -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)
Expand Down
Loading