简体   繁体   English

如何禁用Elixir中类型定义的文档生成?

[英]How to disable doc generating for type definitions in Elixir?

For example I have a module like 例如我有一个像

defmodule Foo do
  @type bar :: string
end

But I don't want to generate doc for bar because it's meant to use internal implementation. 但是我不想为bar生成文档,因为它打算使用内部实现。

There's @typedoc for types like @doc for functions, but unlike @doc false , @typedoc false doesn't seem to hide the type from the documentation. @typedoc的类型类似于@doc的函数,但是与@doc false不同, @typedoc false似乎并未从文档中隐藏类型。 Since this is for internal use, I'm assuming you don't want to export it out of the module either, so you can use @typep to declare it private, which will also remove it from the documentation: 由于这是供内部使用,因此我假设您也不想将其导出到模块之外,因此可以使用@typep声明为私有,这也将从文档中删除它:

defmodule Foo do
  @typep bar :: string
end

I believe that you can use the flag 我相信你可以使用标志

@doc false

on top of the code you dont want docs for. 在您不需要文档的代码之上。 As shown in the docs: 如文档所示: 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM