# ymlr - A YAML Encoder for Elixir
ymlr - A YAML encoder for Elixir.
[](https://github.com/ufirstgroup/ymlr/actions?query=workflow%3ACI)
[](https://codecov.io/gh/ufirstgroup/ymlr)
[](https://hex.pm/packages/ymlr)
[](https://hex.pm/packages/ymlr)
[](https://hexdocs.pm/ymlr/)

## Installation
The package can be installed by adding `ymlr` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:ymlr, "~> 3.0"}
]
end
```
## Examples
See The usage livebook `usage.livemd` for more detailed examples.
### Encode a single document - optionally with comments:
```elixir
iex> Ymlr.document!(%{a: 1})
"""
---
a: 1
"""
iex> Ymlr.document!({"comment", %{a: 1}})
"""
---
# comment
a: 1
"""
iex> Ymlr.document!({["comment 1", "comment 2"], %{"a" => "a", "b" => :b, "c" => "true", "d" => "100"}})
"""
---
# comment 1
# comment 2
a: a
b: b
c: 'true'
d: '100'
"""
```
### Encode a multiple documents
```elixir
iex> Ymlr.documents!([%{a: 1}, %{b: 2}])
"""
---
a: 1
---
b: 2
"""
```