vic/iexample
Mix formatted documentation iex examples.
{ "defaultBranch": "master", "description": "Mix formatted documentation iex examples.", "fullName": "vic/iexample", "homepage": "", "language": "Elixir", "name": "iexample", "pushedAt": "2018-04-03T18:13:32Z", "stargazersCount": 1, "updatedAt": "2023-10-07T18:50:13Z", "url": "https://github.com/vic/iexample"}IExample - Elixir formatted documentation examples.
Section titled “IExample - Elixir formatted documentation examples.”Just interpolate the result of iexample into your documentation strings.
Note that for this to work, your docs should allow interpolation (dont use ~S)
and the interpolation should happen at the start of a new line.
The iexample/2 macro takes the expression result and a code block, and simply generates
an iex example string.
The following code from test/support/example.ex, would generate:
iex> 12 * 336defmodule MyModule do import IExample
@moduledoc """ Math works
#{ iexample(36) do 12 * 3 end } """endThen just run mix format and the interpolated code should be formatted for you nicely.
Installation
Section titled “Installation”def deps do [ {:iexample, "~> 0.1"} ]endDocumentation can be found at https://hexdocs.pm/iexample.