Skip to content

Commit

Permalink
Replace more quotes with admonition blocks in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
whatyouhide committed Mar 5, 2023
1 parent 2b1a768 commit a20da2b
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 13 deletions.
24 changes: 18 additions & 6 deletions lib/elixir/lib/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -636,10 +636,14 @@ defmodule Application do
If the configuration parameter does not exist, the function returns the
`default` value.
> **Important:** you must use this function to read only your own application
> #### Warning {: .warning}
>
> You must use this function to read only your own application
> environment. Do not read the environment of other applications.
> **Important:** if you are writing a library to be used by other developers,
> #### Application environment in libraries {: .info}
>
> If you are writing a library to be used by other developers,
> it is generally recommended to avoid the application environment, as the
> application environment is effectively a global storage. For more information,
> read our [library guidelines](library-guidelines.md).
Expand Down Expand Up @@ -693,10 +697,14 @@ defmodule Application do
If the configuration parameter does not exist, the function returns `:error`.
> **Important:** you must use this function to read only your own application
> #### Warning {: .warning}
>
> You must use this function to read only your own application
> environment. Do not read the environment of other applications.
> **Important:** if you are writing a library to be used by other developers,
> #### Application environment in info
>
> If you are writing a library to be used by other developers,
> it is generally recommended to avoid the application environment, as the
> application environment is effectively a global storage. For more information,
> read our [library guidelines](library-guidelines.md).
Expand All @@ -716,10 +724,14 @@ defmodule Application do
If the configuration parameter does not exist, raises `ArgumentError`.
> **Important:** you must use this function to read only your own application
> #### Warning {: .warning}
>
> You must use this function to read only your own application
> environment. Do not read the environment of other applications.
> **Important:** if you are writing a library to be used by other developers,
> #### Application environment in info
>
> If you are writing a library to be used by other developers,
> it is generally recommended to avoid the application environment, as the
> application environment is effectively a global storage. For more information,
> read our [library guidelines](library-guidelines.md).
Expand Down
4 changes: 3 additions & 1 deletion lib/elixir/lib/config.ex
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ defmodule Config do
`Config` also provides a low-level API for evaluating and reading
configuration, under the `Config.Reader` module.
> **Important:** if you are writing a library to be used by other developers,
> #### Avoid application environment in libraries {: .info}
>
> If you are writing a library to be used by other developers,
> it is generally recommended to avoid the application environment, as the
> application environment is effectively a global storage. Also note that
> the `config/config.exs` of a library is not evaluated when the library is
Expand Down
6 changes: 4 additions & 2 deletions lib/elixir/lib/kernel.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3454,8 +3454,10 @@ defmodule Kernel do
will be available at compile-time. Custom attributes may be configured to
behave closer to Erlang by using `Module.register_attribute/3`.
> **Important:** Libraries and frameworks should consider prefixing any
> module attributes that are private by underscore, such as `@_my_data`
> #### Prefixing module attributes {: .tip}
>
> Libraries and frameworks should consider prefixing any
> module attributes that are private by underscore, such as `@_my_data`,
> so code completion tools do not show them on suggestions and prompts.
Finally, note that attributes can also be read inside functions:
Expand Down
4 changes: 3 additions & 1 deletion lib/elixir/lib/kernel/special_forms.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,9 @@ defmodule Kernel.SpecialForms do
reported to where `defadd` was invoked. `location: :keep` affects
only definitions inside the quote.
> **Important:** do not use `location: :keep` if the function definition
> #### `location: :keep` and unquote {: .warning}
>
> Do not use `location: :keep` if the function definition
> also `unquote`s some of the macro arguments. If you do so, Elixir
> will store the file definition of the current location but the
> unquoted arguments may contain line information of the macro caller,
Expand Down
10 changes: 7 additions & 3 deletions lib/elixir/lib/system.ex
Original file line number Diff line number Diff line change
Expand Up @@ -489,8 +489,10 @@ defmodule System do
@doc """
Traps the given `signal` to execute the `fun`.
> **Important**: Trapping signals may have strong implications
> on how a system shuts down and behave in production and
> #### Avoid setting traps in libraries {: .warning}
>
> Trapping signals may have strong implications
> on how a system shuts down and behaves in production and
> therefore it is extremely discouraged for libraries to
> set their own traps. Instead, they should redirect users
> to configure them themselves. The only cases where it is
Expand Down Expand Up @@ -911,7 +913,9 @@ defmodule System do
It uses `sh` for Unix-like systems and `cmd` for Windows.
> **Important:**: Use this function with care. In particular, **never
> #### Watch out {: .warning}
>
> Use this function with care. In particular, **never
> pass untrusted user input to this function**, as the user would be
> able to perform "command injection attacks" by executing any code
> directly on the machine. Generally speaking, prefer to use `cmd/3`
Expand Down

0 comments on commit a20da2b

Please sign in to comment.