edoc(3erl)
edoc(3erl) β Erlang Module Definition π
bestie, this is the page for theedocmodule, and the manual-name energy is right here near the top:edoc. We're documenting docs. It's meta like that. β¨
NAME
edoc β EDoc, the Erlang program documentation generator. π
DESCRIPTION
EDoc - the Erlang program documentation generator. πΈ
This module gives you the main user interface to EDoc. It's literally the front door. π«Ά
- EDoc User Manual π
- Running EDoc πββοΈ
DATA TYPES π§
comment()=erl_comment_scan:comment():edoc_module()=xmerl_scan:xmlElement(): The EDoc documentation data for a module, expressed as an XML document in XMerL format. See the fileedoc.dtdfor details. π¦entry()=#entry{name=function_name() | atom(), args=[atom() | list()], line=integer(), export=boolean(), data=entry_data()}:Module Entries (one per function, plus module header and footer). πentry_data()=term():env()=#env{}: Environment information needed by EDoc for generating references. πfilename()=file:filename():function_name()={atom(), integer()}:module_meta()=#module{name=[] | atom(), parameters=none | [atom()], functions=ordset(function_name()), exports=ordset(function_name()), attributes=ordset({atom(), term()}), records=[{atom(), [{atom(), term()}]}], encoding=epp:source_encoding(), file=file:filename()}:Module information. ποΈordset(T)=ordsets:ordset(T):proplist()=proplists:proplist():syntaxTree()=erl_syntax:syntaxTree():tag()=#tag{name=atom(), line=integer(), origin=comment | code, data=term(), form=undefined | erl_parse:abstract_form()}:Generic tag information.#tag.formis only defined if#tag.originiscode, that is the#tag{}represents a code fragment, not a doc comment tag. π·οΈ
EXPORTS π
application(App::atom()) -> ok
Equivalent to application(Application, []). π
application(App, Options) -> ok
Types:
App = atom()
Options = proplist()
Run EDoc on an application in its default app-directory. See application/3 for details. πββοΈπ¨
See also: application/1.
application(App, Dir, Options) -> ok
Types:
App = atom()
Dir = filename()
Options = proplist()
Run EDoc on an application located in the specified directory. Tries to automatically set up good defaults. Unless the user specifies otherwise: β¨
- The
docsubdirectory will be used as the target directory, if it exists; otherwise the application directory is used. π― - The source code is assumed to be located in the
srcsubdirectory, if it exists, or otherwise in the application directory itself. π - The
subpackagesoption is turned on. All found source files will be processed. ποΈ - The
includesubdirectory is automatically added to the include path. (Only important if preprocessing is turned on.) π
See run/2 for details, including options.
See also: application/2.
file(Name::filename()) -> ok
This function is deprecated: See file/2 for details. π¨
Equivalent to file(Name, []).
file(Name, Options) -> ok
Types:
Name = filename()
Options = proplist()
This function is deprecated: This is part of the old interface to EDoc and is mainly kept for backwards compatibility. The preferred way of generating documentation is through one of the functions application/2 and files/2. π΅
Reads a source code file and outputs formatted documentation to a corresponding file. π
Options:
{dir, filename()}: Specifies the output directory for the created file. (By default, the output is written to the directory of the source file.) π{source_suffix, string()}: Specifies the expected suffix of the input file. The default value is".erl". π§Ύ{file_suffix, string()}: Specifies the suffix for the created file. The default value is".html". π
See get_doc/2 and layout/2 for further options.
For running EDoc from a Makefile or similar, see edoc_run:file/1.
See also: read/2.
files(Files::[filename()]) -> ok
files(Files, Options) -> ok
Types:
Files = [filename()]
Options = proplist()
Runs EDoc on a given set of source files. See run/2 for details, including options. π
get_doc(File::filename()) -> {module(), edoc_module()}
Equivalent to get_doc(File, []).
get_doc(File, Options) -> R
Types:
File = filename()
Options = proplist()
R = {module(), edoc_module()} | {module(), edoc_module(), [entry()]}
Reads a source code file and extracts EDoc documentation data. Note that without an environment parameter (see get_doc/3), hypertext links may not be correct. π
Options:
{def, Macros}:Macros = Macro | [Macro]Macro = {Name::atom(), Text::string() | MacroFun}MacroFun = fun((MacroArgument::string(), Line::integer(), edoc_lib:edoc_env()) -> (Text::string()))
Specifies a set of user-defined EDoc macros. The text substituted for macro calls is specified as either a string() or a function(). The function is called with the macro argument text, the current line number, and the current environment. The fun is to return a string(). See Macro expansion for details. πͺ
{hidden, boolean()}: If the value istrue, documentation of hidden functions will also be included. The default value isfalse. π{private, boolean()}: If the value istrue, documentation of private functions will also be included. The default value isfalse. π{todo, boolean()}: If the value istrue, To-Do notes written using@todoor@TODOtags will be included in the documentation. The default value isfalse. π
See read_source/2, read_comments/2 and edoc_lib:get_doc_env/3 for further options.
See also: get_doc/3, layout/2, read/2, run/2, edoc_extract:source/5.
get_doc(File, Env, Options) -> R
Types:
File = filename()
Env = env()
Options = proplist()
R = {module(), edoc_module()} | {module(), edoc_module(), [entry()]}
Like get_doc/2, but for a given environment parameter. Env is an environment created by edoc_lib:get_doc_env/3. π
layout(Doc::edoc_module()) -> string()
Equivalent to layout(Doc, []).
layout(Doc, Opts) -> string()
Types:
Doc = edoc_module()
Opts = proplist()
Transforms EDoc module documentation data to text. The default layout creates an HTML document. π¨
Options:
{layout, Module::atom()}: Specifies a callback module to be used for formatting. The module must export a functionmodule(Doc, Options). The default callback module isedoc_layout; seeedoc_layout:module/2for layout-specific options. π§©
See also: file/2, layout/1, read/2, run/2.
read(File::filename()) -> string()
Equivalent to read(File, []).
read(File, Opts) -> string()
Types:
File = filename()
Opts = proplist()
Reads and processes a source file and returns the resulting EDoc-text as a string. See get_doc/2 and layout/2 for options. π
See also: file/2.
read_comments(File::filename()) -> [comment()]
Equivalent to read_comments(File, []).
read_comments(File, Opts) -> [comment()]
Types:
File = filename()
Opts = proplist()
Extracts comments from an Erlang source code file. See the module erl_comment_scan(3erl) for details on the representation of comments. Currently, no options are available. π¬
read_source(Name::filename()) -> [syntaxTree()]
Equivalent to read_source(File, []).
read_source(File, Opts) -> [syntaxTree()]
Types:
File = filename()
Opts = proplist()
Reads an Erlang source file and returns the list of "source code form" syntax trees. π³
Options:
{preprocess, boolean()}: If the value istrue, the source file will be read via the Erlang preprocessor (epp). The default value isfalse.no_preprocessis an alias for{preprocess, false}. π§ͺ
Normally, preprocessing is not necessary for EDoc to work, but if a file contains too exotic definitions or uses of macros, it will not be possible to read it without preprocessing. Note: comments in included files will not be available to EDoc, even with this option enabled. β οΈ
{includes, Path::[string()]}: Specifies a list of directory names to be searched for include files, if the preprocess option is turned on. Also used with the@headerfiletag. The default value is the empty list. The directory of the source file is always automatically appended to the search path. π{macros, [{atom(), term()}]}: Specifies a list of pre-defined Erlang preprocessor (epp) macro definitions, used if the preprocess option is turned on. The default value is the empty list. π§¬{report_missing_types, boolean()}: If the value istrue, warnings are issued for missing types. The default value isfalse.no_report_missing_typesis an alias for{report_missing_types, false}. π¨{link_predefined_types, boolean()}: If the value istrue, all predefined data types will have a link to theerlangmodule. This option is to be used when generating documentation for the Erlang/OTP docs. The default value isfalse.no_link_predefined_typesis an alias for{link_predefined_types, false}. π
See also: erl_syntax(3erl), get_doc/2.
run(Files, Opts) -> ok
Types:
Files = [filename()]
Opts = proplist()
Runs EDoc on a given set of source files. Note that the doclet plugin module has its own particular options; see the doclet option below. πββοΈ
Also see layout/2 for layout-related options, and get_doc/2 for options related to reading source files. π
Okay, options time β every single one, no skipping, because they all do something and you deserve the whole menu. π
{app_default, string()}β sets the default base URI for applications that are still unknown. The "we don't know her yet" fallback, basically.{application, App::atom()}β says the documentation being generated describes the applicationApp. This mainly affects generated references β so the refs know what's up.{dir, filename()}β the target directory where the generated documentation goes.{doc_path, [string()]}β a list of file system paths pointing to directories that contain EDoc-generated documentation. All paths for applications in the code path are automatically added, so you don't have to hand-add those.{doclet, Module::atom()}β the callback module used for creating the documentation. It must export a functionrun(Cmd, Ctxt). The default doclet module isedoc_doclet; seeedoc_doclet:run/2for doclet-specific options.{file_suffix, string()}β the suffix used for output files. Default is".html". Heads up: this also affects generated references.{new, boolean()}β iftrue, any existingedoc-infofile in the target directory is ignored and overwritten. Default isfalse.{source_path, [filename()]}β a list of file system paths used to locate the source code for packages.{source_suffix, string()}β the expected suffix of input files. Default is".erl".{subpackages, boolean()}β iftrue, all subpackages of the specified packages are also included in the documentation. Default isfalse.no_subpackagesis an alias for{subpackages, false}.
Subpackage source files are found by recursively searching for source code files in subdirectories of the known source code root directories. (Also see the source_path option.) Directory names must begin with a lowercase letter and contain only alphanumeric characters and underscore, or they will be ignored. (For example, a subdirectory named test-files will not be searched.)
See also: application/2, files/2.
π AUTHORS π
Richard Carlsson <carlsson.richard@gmail.com> β iconic, credited, periodt. π
That's the whole edoc 1.2 situation, bestie β straight from the edoc(3erl) manual page. Version and manual section secured; the footer didn't hand us a date, and we're not inventing one. π
β¨
π¦ where this page comes from
- debian bookworm: erlang-manpages 1:25.2.3+dfsg-1+deb12u1 Β· Apache-2.0
- debian bookworm: erlang-manpages 1:25.2.3+dfsg-1+deb12u4 Β· Apache-2.0
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4 Β· Apache-2.0
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4.8 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms