Link 到 ExDoc 中的外部类型

Link to external types in ExDoc

我最近创建了我的第一个十六进制包; Ecto.Rut 我现在正在处理它的文档。因为它在后面使用 Ecto.Repo 和 returns Ecto.SchemaEcto.Changeset 类型,所以我想在 @specs.link 中使用它们。

内部和 Elixir 核心类型(例如 Keyword.t)会自动 linked,但 ex_doc 不会 link 在 Ecto 模块中定义的外部类型。我该如何做到这一点?

我目前尝试在 @spec 中指定完整的模块名称,但这不起作用:

@callback all(opts :: Keyword.t) :: [Ecto.Schema.t] | no_return

some discussion on ElixirForum之后,何塞添加了这个功能。从 ExDoc v0.14.2 开始,它支持外部依赖模块的自动链接。

来自Github Page

By referring to a module, function, type or callback from any of your dependencies, such as MyDep, ExDoc will automatically link to that dependency documentation on hexdocs.pm (the link can be configured with the :deps option in your mix.exs)


这意味着,只需提及完整的模块名称即可自动链接类型、回调、模块和方法。因此,通过更新到最新的 ExDoc,我现有的代码现在自动链接:

@callback all(opts :: Keyword.t) :: [Ecto.Schema.t] | no_return