feat: add source hyperlinks + remove thin from-source.md
Every source reference now links to elixir-lang/elixir at commit f4e1b34. 122 hyperlinks across 11 topic files. Added PATTERN_COMPLETE sentinels. Removed from-source.md (326 lines, shallow) — covered by existing files.
This commit is contained in:
+10
-8
@@ -4,7 +4,7 @@ How behaviours are designed, implemented, and used in Elixir core and Phoenix.
|
||||
|
||||
## 1. Behaviour Definition with `@callback`
|
||||
|
||||
**Source:** `lib/elixir/lib/gen_server.ex:577-812` (all callback definitions)
|
||||
**Source:** [lib/elixir/lib/gen_server.ex#L577](https://github.com/elixir-lang/elixir/blob/f4e1b34617ef92052b65781f18eae5b88a490098/lib/elixir/lib/gen_server.ex#L577) (all callback definitions)
|
||||
|
||||
```elixir
|
||||
@callback init(init_arg :: term) ::
|
||||
@@ -89,7 +89,7 @@ end
|
||||
|
||||
## 2. `@optional_callbacks` for Extensibility
|
||||
|
||||
**Source:** `lib/phoenix/channel.ex:442-448`
|
||||
**Source:** [lib/phoenix/channel.ex#L442](https://github.com/elixir-lang/elixir/blob/f4e1b34617ef92052b65781f18eae5b88a490098/lib/phoenix/channel.ex#L442)
|
||||
|
||||
```elixir
|
||||
@optional_callbacks handle_in: 3,
|
||||
@@ -168,7 +168,7 @@ end
|
||||
|
||||
## 3. `@behaviour` Declaration in `__using__`
|
||||
|
||||
**Source:** `lib/phoenix/channel.ex:450-453`
|
||||
**Source:** [lib/phoenix/channel.ex#L450](https://github.com/elixir-lang/elixir/blob/f4e1b34617ef92052b65781f18eae5b88a490098/lib/phoenix/channel.ex#L450)
|
||||
|
||||
```elixir
|
||||
defmacro __using__(opts \\ []) do
|
||||
@@ -182,7 +182,7 @@ defmacro __using__(opts \\ []) do
|
||||
end
|
||||
```
|
||||
|
||||
**Source:** `lib/elixir/lib/gen_server.ex:836`
|
||||
**Source:** [lib/elixir/lib/gen_server.ex#L836](https://github.com/elixir-lang/elixir/blob/f4e1b34617ef92052b65781f18eae5b88a490098/lib/elixir/lib/gen_server.ex#L836)
|
||||
|
||||
```elixir
|
||||
quote location: :keep, bind_quoted: [opts: opts] do
|
||||
@@ -270,7 +270,7 @@ end
|
||||
|
||||
## 4. Default Implementations via `defoverridable`
|
||||
|
||||
**Source:** `lib/elixir/lib/gen_server.ex:849`
|
||||
**Source:** [lib/elixir/lib/gen_server.ex#L849](https://github.com/elixir-lang/elixir/blob/f4e1b34617ef92052b65781f18eae5b88a490098/lib/elixir/lib/gen_server.ex#L849)
|
||||
|
||||
```elixir
|
||||
def child_spec(init_arg) do
|
||||
@@ -358,7 +358,7 @@ end
|
||||
|
||||
## 5. Phoenix Channel: Behaviour + Process + Protocol
|
||||
|
||||
**Source:** `lib/phoenix/channel.ex:364-448` (full callback set)
|
||||
**Source:** [lib/phoenix/channel.ex#L364](https://github.com/elixir-lang/elixir/blob/f4e1b34617ef92052b65781f18eae5b88a490098/lib/phoenix/channel.ex#L364) (full callback set)
|
||||
|
||||
The Channel behaviour combines:
|
||||
1. **Required callback:** `join/3` (authorization gate)
|
||||
@@ -475,7 +475,7 @@ end
|
||||
|
||||
## 6. Callback Documentation Pattern
|
||||
|
||||
**Source:** `lib/phoenix/channel.ex:350-363` (join callback doc)
|
||||
**Source:** [lib/phoenix/channel.ex#L350](https://github.com/elixir-lang/elixir/blob/f4e1b34617ef92052b65781f18eae5b88a490098/lib/phoenix/channel.ex#L350) (join callback doc)
|
||||
|
||||
```elixir
|
||||
@doc """
|
||||
@@ -591,7 +591,7 @@ This callback is required.
|
||||
|
||||
## 7. Phoenix.Endpoint: Behaviour as Interface Contract
|
||||
|
||||
**Source:** `lib/phoenix/endpoint.ex:408`
|
||||
**Source:** [lib/phoenix/endpoint.ex#L408](https://github.com/elixir-lang/elixir/blob/f4e1b34617ef92052b65781f18eae5b88a490098/lib/phoenix/endpoint.ex#L408)
|
||||
|
||||
```elixir
|
||||
defmacro __using__(opts) do
|
||||
@@ -677,3 +677,5 @@ end
|
||||
```
|
||||
|
||||
**Why:** The more code a `use` macro generates, the harder it is to debug. If users regularly need to read the generated code to understand failures, the abstraction is leaking. Reserve heavy `use` macros for well-established patterns (GenServer, Endpoint, Channel) where the community has internalized the mental model.
|
||||
|
||||
<!-- PATTERN_COMPLETE -->
|
||||
|
||||
Reference in New Issue
Block a user