View Source Zig.Doc (zig_doc v0.1.2)

Incorporates Zig documentation from selected files into Elixir projects.

usage

Usage

  1. Include the zig files you wish to document in your project docs:

        def project do
          [
            docs: [
              ...
              zig_doc: [name_of_module: [file: "path/to/file.zig"]]
            ]
          ]
        end
  2. (optional) alias Zig.Doc in your mix.exs:

      def project do
        [
          ...
          aliases: [
            docs: ["zig_doc"]
          ]
          ...
        ]
      end

    note

    Note

    This step is required if you want HexDocs.pm to include the zig documentation with your main documentation.

documentation-forms

Documentation forms

Currently, Zigler recognizes the following forms of documentation:

  • files

    This form is set using the //! at the top of a document, and will be used as the "module-level" documentation for the ExDoc result.

  • functions

    Public functions: pub const <identifier> = <value that is a function>; and publically declared functions: pub fn <identifier>(<arguments>) <type> { <block> } are both recognized and converted to ExDoc-style function documentation.

  • types

    pub const <type> = <expression that is a type>; is recognized and converted into ExDoc-style type documentation.

  • constants

    pub const <identifier> = <expression that is a constant>; is recognized and converted into ExDoc-style function documentation under the category Constants.

  • variables

    pub var <identifier> = ...; is recognized and converted into ExDoc-style function documentation under the category Variables.

warning

Warning

Currently Zig.Doc is lazily written to support the use case for beam.zig found in the the main Zigler project. It is very likely that custom zig files used in a nif might not be correctly parsed. If you find this to be the case, please file an issue at: https://github.com/E-xyza/zig_doc/issues

Link to this section Summary

Functions

Generates documentation for the given project, vsn (version) and options.

Link to this section Functions

Link to this function

generate_docs(project, vsn, options)

View Source
@spec generate_docs(String.t(), String.t(), Keyword.t()) :: atom()

Generates documentation for the given project, vsn (version) and options.

Lifted and modified from ExDoc.generate_docs in ex_doc 0.29.4.