Readmix.Generators.BuiltIn (readmix v0.5.0)

Implements the built-in generators for Readmix.

Readmix Actions

app_dep

Generates a fenced code block for the deps function in mix.exs, pulling a package from hex.pm.

Parameters

  • :otp_app (String.t/0) - The OTP application to use in the dependency tuple. Defaults to the current application.

  • :vsn (String.t/0) - The version number to use. Defaults to the current version of the OTP application.

  • :comma (boolean/0) - Include a comma after the dependency tuple. The default value is true.

  • :patch (boolean/0) - Include the patch in the version number in the dependency tuple. The default value is false.

  • :only (String.t/0) - Adds the :only option to the dependency tuple. Multiple environments can be separated with commas.

  • :runtime (boolean/0) - When false, adds the runtime: false option to the dependency tuple.

badges

Generates badges with img.shields.io.

Badges are generated in the order of the action params.

Parameters

  • :hexpm (String.t/0) - Generates a badge linking to hex.pm.

    Requires a package name and an optional query string for customization.

    Example: "readmix?color=4e2a8e".

  • :github_action (String.t/0) - Generates a badge linking to the latest Github Action.

    Requires a package name and an optional query string for customization and limiting to a branch name.

    Example: "lud/readmix/elixir.yaml?label=CI&branch=main".

  • :license (String.t/0) - Generates a badge linking to a license for an Elixir package.

    Requires an hex.pm package name.

    Example: "readmix".

section

Defines a named block that other generator actions can retrieve during generation.

The section itself doesn't transform content but allows nested blocks to be processed.

Note that uniqueness of names is not enforced.

Parameters

  • :name (String.t/0) - Required. The name of the section.

eval

Evaluates a fenced code block from the last section with the given name at the same nesting level and outputs the result of the evaluation in a fenced code block.

Example

<!-- rdmx :section name:example -->
```elixir
map = %{hello: "World"}
Map.fetch!(map, :hello)
```
<!-- rdmx /:section -->

<!-- rdmx :eval section:example -->
```elixir
"World"
```
<!-- rdmx /:eval -->

Parameters

  • :section (String.t/0) - Required. The name of the section to evaluate.

  • :catch (boolean/0) - Allow errors and display exception banners as output in case of error. The default value is false.