{"id":13509776,"url":"https://github.com/ufirstgroup/ymlr","last_synced_at":"2026-03-15T14:23:36.071Z","repository":{"id":39864286,"uuid":"283977560","full_name":"ufirstgroup/ymlr","owner":"ufirstgroup","description":"A YAML encoder for Elixir.","archived":false,"fork":false,"pushed_at":"2025-03-28T18:19:56.000Z","size":369,"stargazers_count":23,"open_issues_count":3,"forks_count":11,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-28T19:28:38.610Z","etag":null,"topics":["elixir","hex","yaml-encoder"],"latest_commit_sha":null,"homepage":"https://hexdocs.pm/ymlr/Ymlr.html","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ufirstgroup.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["mruoss"]}},"created_at":"2020-07-31T07:57:36.000Z","updated_at":"2025-03-28T18:18:39.000Z","dependencies_parsed_at":"2023-12-13T12:43:21.119Z","dependency_job_id":"1030356d-5aa0-41ea-a69e-bfd27a810d47","html_url":"https://github.com/ufirstgroup/ymlr","commit_stats":{"total_commits":159,"total_committers":5,"mean_commits":31.8,"dds":0.5094339622641509,"last_synced_commit":"5b9ae79a39e41028e8f523760394f0a3585fbc67"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ufirstgroup%2Fymlr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ufirstgroup%2Fymlr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ufirstgroup%2Fymlr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ufirstgroup%2Fymlr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ufirstgroup","download_url":"https://codeload.github.com/ufirstgroup/ymlr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246088895,"owners_count":20721782,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elixir","hex","yaml-encoder"],"created_at":"2024-08-01T02:01:12.863Z","updated_at":"2025-10-20T11:13:52.269Z","avatar_url":"https://github.com/ufirstgroup.png","language":"Elixir","funding_links":["https://github.com/sponsors/mruoss"],"categories":["YAML"],"sub_categories":[],"readme":"# ymlr - A YAML Encoder for Elixir\n\nymlr - A YAML encoder for Elixir.\n\n[![Module Version](https://img.shields.io/hexpm/v/ymlr.svg)](https://hex.pm/packages/ymlr)\n[![Coverage Status](https://coveralls.io/repos/github/ufirstgroup/ymlr/badge.svg?branch=main)](https://coveralls.io/github/ufirstgroup/ymlr?branch=main)\n[![Last Updated](https://img.shields.io/github/last-commit/ufirstgroup/ymlr.svg)](https://github.com/ufirstgroup/ymlr/commits/main)\n\n[![Build Status Code Qualits](https://github.com/ufirstgroup/ymlr/actions/workflows/code_quality.yaml/badge.svg)](https://github.com/ufirstgroup/ymlr/actions/workflows/code_quality.yaml)\n[![Build Status Elixir](https://github.com/ufirstgroup/ymlr/actions/workflows/elixir_matrix.yaml/badge.svg)](https://github.com/ufirstgroup/ymlr/actions/workflows/elixir_matrix.yaml)\n\n[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/ymlr/)\n[![Total Download](https://img.shields.io/hexpm/dt/ymlr.svg)](https://hex.pm/packages/ymlr)\n[![License](https://img.shields.io/hexpm/l/ymlr.svg)](https://github.com/ufirstgroup/ymlr/blob/main/LICENSE)\n\n## Installation\n\nThe package can be installed by adding `ymlr` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:ymlr, \"~\u003e 5.0\"}\n  ]\nend\n```\n\n## Examples\n\nSee The usage livebook `usage.livemd` for more detailed examples.\n\n### Encode a single document - optionally with comments:\n\n```elixir\n  iex\u003e Ymlr.document!(%{a: 1})\n  \"\"\"\n  ---\n  a: 1\n  \"\"\"\n\n  iex\u003e Ymlr.document!({\"comment\", %{a: 1}})\n  \"\"\"\n  ---\n  # comment\n  a: 1\n  \"\"\"\n\n  iex\u003e Ymlr.document!({[\"comment 1\", \"comment 2\"], %{\"a\" =\u003e \"a\", \"b\" =\u003e :b, \"c\" =\u003e \"true\", \"d\" =\u003e \"100\"}})\n  \"\"\"\n  ---\n  # comment 1\n  # comment 2\n  a: a\n  b: b\n  c: 'true'\n  d: '100'\n  \"\"\"\n```\n\n### Encode a multiple documents\n\n```elixir\niex\u003e Ymlr.documents!([%{a: 1}, %{b: 2}])\n\"\"\"\n---\na: 1\n\n---\nb: 2\n\"\"\"\n```\n\n## Support for atoms\n\nBy default, atoms as map keys are encoded as strings (without the leading\ncolon). If you want atoms to be encoded with a leading colon in order to be able\nto parse it later using [`YamlElixir`'s `atoms`\noption](https://hexdocs.pm/yaml_elixir/readme.html#support-for-atoms), you can\npass `atoms: true` as second argument to any of the `Ymlr` module's functions:\n\n```elixir\niex\u003e Ymlr.document!(%{a: 1}, atoms: true)\n\"\"\"\n---\n:a: 1\n\"\"\"\n```\n\n### Encode maps with keys sorted\n\nMaps in elixir, implemented by erlang `:maps`, internally are `flatmap`s or `hashmap`s by size.\nLarge maps will be encoded in strange order.\n\n```elixir\niex\u003e 1..33 |\u003e Map.new(\u0026{\u00261, \u00261})|\u003e Ymlr.document!() |\u003e IO.puts\n---\n4: 4\n25: 25\n8: 8\n...\n\n```\n\nBy using `:sort_maps` option, ymlr will encode all entries sorted.\n\n```elixir\niex\u003e 1..33 |\u003e Map.new(\u0026{\u00261, \u00261})|\u003e Ymlr.document!(sort_maps: true) |\u003e IO.puts\n---\n1: 1\n2: 2\n3: 3\n...\n\n```\n\n## Benchmark\n\nThis library does not claim to be particularly performant. We do have a script\nto benchmark encoding so we know if performance gets better or worse with\nchanges.\n\nYou can find the last Benchmark in [BENCHMARK.md](BENCHMARK.md)\n\n### Running the script\n\n```bash\ncd benchmark/\nelixir run.exs\n```\n\n## Development\n\nWe're using [mise-en-place](https://mise.jdx.dev/) to install and manage\ntooling. Please [install it](https://mise.jdx.dev/getting-started.html) and run\n`mise init` before you start coding. This will also setup pre-commit hooks\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fufirstgroup%2Fymlr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fufirstgroup%2Fymlr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fufirstgroup%2Fymlr/lists"}