ExOKF.Link (ex_okf v0.1.0)

Copy Markdown View Source

A markdown link extracted from a concept or reserved document body.

Internal links resolve to concept IDs (paths without .md) and become directed edges in ExOKF.Graph. External links keep their original URL and are treated as citations or outbound references rather than graph edges.

Fields

FieldTypeDescription
textString.t()Visible link text, e.g. "customers".
targetString.t()Raw href as written in markdown, e.g. "/tables/customers.md".
kindkind/0Classification of the target (see below).
concept_idString.t() | nilResolved concept id when kind is :internal; otherwise nil.
source_pathString.t() | nilBundle-relative path of the file containing the link, e.g. "tables/orders.md".

Examples

%ExOKF.Link{
  text: "customers",
  target: "/tables/customers.md",
  kind: :internal,
  concept_id: "tables/customers",
  source_path: "tables/orders.md"
}

%ExOKF.Link{
  text: "BigQuery console",
  target: "https://console.cloud.google.com/bigquery",
  kind: :external,
  concept_id: nil,
  source_path: "tables/orders.md"
}

Summary

Types

How a link target is classified.

t()

An extracted markdown link.

Functions

Returns true when the link points at another concept in the bundle.

Types

kind()

@type kind() :: :internal | :external | :anchor | :other

How a link target is classified.

  • :internal — points at another concept in the bundle (absolute /… or relative path)
  • :external — absolute URI with a scheme (https:, mailto:, …)
  • :anchor — in-document fragment only (#section)
  • :other — directory links, non-markdown assets, or unresolved paths

t()

@type t() :: %ExOKF.Link{
  concept_id: String.t() | nil,
  kind: kind(),
  source_path: String.t() | nil,
  target: String.t(),
  text: String.t()
}

An extracted markdown link.

See the module documentation for field meanings and realistic examples.

Functions

internal?(link)

@spec internal?(t()) :: boolean()

Returns true when the link points at another concept in the bundle.

Parameters

  • link (t/0) — link to inspect

Examples

iex> ExOKF.Link.internal?(%ExOKF.Link{text: "c", target: "/c.md", kind: :internal, concept_id: "c"})
true

iex> ExOKF.Link.internal?(%ExOKF.Link{text: "docs", target: "https://example.com", kind: :external})
false