#Formatting elixir, especially docs

5 messages · Page 1 of 1 (latest)

placid pendant
#

I was looking at the Kino source code and noticed, that the docs are nicely formatted ending at 60 chars per line.
What tooling achieves this? The project does not have a dialyzer task and mix format does not change anything for me.

here an example of neatly formatted docs:

  @doc """
  Creates a new select input.

  The input expects a list of options in the form `[{value, label}]`,
  where `value` is an arbitrary term and `label` is a descriptive
  string.

  ## Options

    * `:default` - the initial input value. Defaults to the first
      value from the given list of options

  ## Examples

      Kino.Input.select("Language", [en: "English", fr: "Français"])

      Kino.Input.select("Language", [{1, "One"}, {2, "Two"}, {3, "Three"}])
  """

What are the best practices here and what is the easiest way to easily format the docs?

violet spindle
#

the last post there summarizes it, altering strings like doc strings would alter the AST and the formatter won't do that AFAIK

#

so I don't think this is a feature that is being planned for the builtin formatter

placid pendant