{"id":20476646,"url":"https://github.com/rabbitmq/stdout_formatter","last_synced_at":"2025-04-13T12:45:03.381Z","repository":{"id":34719951,"uuid":"178245410","full_name":"rabbitmq/stdout_formatter","owner":"rabbitmq","description":"Erlang library to format paragraphs, lists and tables as plain text","archived":false,"fork":false,"pushed_at":"2023-06-26T15:20:54.000Z","size":93,"stargazers_count":15,"open_issues_count":0,"forks_count":5,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-03-27T03:51:16.814Z","etag":null,"topics":["elixir","erlang","erlang-libraries","formatter","stdout","text"],"latest_commit_sha":null,"homepage":null,"language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rabbitmq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2019-03-28T16:46:54.000Z","updated_at":"2024-03-08T15:26:25.000Z","dependencies_parsed_at":"2024-11-15T16:32:05.409Z","dependency_job_id":null,"html_url":"https://github.com/rabbitmq/stdout_formatter","commit_stats":{"total_commits":22,"total_committers":3,"mean_commits":7.333333333333333,"dds":0.09090909090909094,"last_synced_commit":"9f9c1e2475b0da3104f5787ecf5568711398261d"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rabbitmq%2Fstdout_formatter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rabbitmq%2Fstdout_formatter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rabbitmq%2Fstdout_formatter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rabbitmq%2Fstdout_formatter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rabbitmq","download_url":"https://codeload.github.com/rabbitmq/stdout_formatter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248717241,"owners_count":21150387,"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","erlang","erlang-libraries","formatter","stdout","text"],"created_at":"2024-11-15T15:22:10.230Z","updated_at":"2025-04-13T12:45:03.360Z","avatar_url":"https://github.com/rabbitmq.png","language":"Erlang","readme":"# stdout_formatter: Format paragraphs and tables for a human-readable text output\n\n[![Build Status](https://travis-ci.com/rabbitmq/stdout_formatter.svg?branch=master)](https://travis-ci.com/rabbitmq/stdout_formatter)\n[![Coverage Status](https://coveralls.io/repos/github/rabbitmq/stdout_formatter/badge.svg?branch=master)](https://coveralls.io/github/rabbitmq/stdout_formatter)\n[![Hex version](https://img.shields.io/hexpm/v/stdout_formatter.svg \"Hex version\")](https://hex.pm/packages/stdout_formatter)\n\n**stdout_formatter** is a pure [Erlang application](http://www.erlang.org/)\nwhich allows an application to format paragraphs and tables as text,\nusually to display it on a terminal. It only depends on standard\nErlang/OTP applications; no external dependency is required. It doesn't\nuse native code either (neither port drivers nor NIFs).\n\nstdout_formatter can be used inside Elixir projects, like any other\nErlang library. You can find an example later in this README.\n\nstdout_formatter is distributed under the terms of both the **Apache\nLicense v2** and **Mozilla Public Licence v1.1**; see `LICENSE`.\n\n## Integrate to your project\n\nstdout_formatter uses [Rebar 3](http://www.rebar3.org/) as its build\nsystem so it can be integrated to many common build systems.\n\n### Rebar\n\nstdout_formatter is available as a [Hex.pm\npackage](https://hex.pm/packages/stdout_formatter). Thus you can simply\nlist it as a package dependency in your `rebar.config`:\n\n```erlang\n{deps, [stdout_formatter]}.\n```\n\n### Erlang.mk\n\nErlang.mk knows about stdout_formatter. You just need to add\n`stdout_formatter` as a dependency in your `Makefile`:\n\n```make\nDEPS = stdout_formatter\ndep_stdout_formatter = git https://github.com/rabbitmq/stdout_formatter.git v0.1.0\n```\n\n### Mix\n\nYou can use stdout_formatter in your Elixir\nproject. stdout_formatter is available as a [Hex.pm\npackage](https://hex.pm/packages/stdout_formatter). Thus you can simply\nlist its name in your `mix.exs`:\n\n```elixir\ndef project do\n  [\n    deps: [{:stdout_formatter, \"~\u003e 0.1.0\"}]\n  ]\nend\n```\n\n## Getting started\n\n### Format and display a paragraph of text\n\nIn this example, we want to format a long paragraph of text to fit it in\nan 80-columns terminal and display it directly.\n\n```erlang\n-include_lib(\"stdout_formatter/include/stdout_formatter.hrl\").\n\nText = \"Lorem ipsum dolor (...) est laborum.\",\n\nstdout_formatter:display(\n  #paragraph{\n    content = Text\n    props = #{wrap_at =\u003e 72}}).\n```\n```\nLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod\ntempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim\nveniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea\ncommodo consequat. Duis aute irure dolor in reprehenderit in voluptate\nvelit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint\noccaecat cupidatat non proident, sunt in culpa qui officia deserunt\nmollit anim id est laborum.\n```\n\n### Format and display a simple table\n\nIn this example, we want to format a table and display it directly.\n\n```erlang\n-include_lib(\"stdout_formatter/include/stdout_formatter.hrl\").\n\nData = [\n         [\"Top left\", \"Top right\"],\n         [\"Bottom left\", \"Bottom right\"]\n       ],\n\nstdout_formatter:display(\n  #table{\n    rows = Data}).\n```\n```\n┌───────────┬────────────┐\n│Top left   │Top right   │\n├───────────┼────────────┤\n│Bottom left│Bottom right│\n└───────────┴────────────┘\n```\n\n### Format and display a complex table with paragraphs inside\n\nIn this example, we mix the previous examples to put a paragraph inside\na table and we start to use colors.\n\n```erlang\n-include_lib(\"stdout_formatter/include/stdout_formatter.hrl\").\n\nText = \"Lorem ipsum dolor (...) est laborum.\",\n\nData = [\n         #row{\n           cells = [\n             \"Initial data\",\n             \"Result\"],\n           props = #{title =\u003e true}},\n         #row{\n           cells = [\n             \"The famous Lorem Ipsum sample\",\n             #paragraph{\n               content = Text,\n               props = #{wrap_at =\u003e 40}}]}\n       ],\n\nstdout_formatter:display(\n  #table{\n    rows = Data}).\n```\n```\n┌─────────────────────────────┬───────────────────────────────────────┐\n│Initial data                 │Result                                 │\n├─────────────────────────────┼───────────────────────────────────────┤\n│The famous Lorem Ipsum sample│Lorem ipsum dolor sit amet, consectetur│\n│                             │adipiscing elit, sed do eiusmod tempor │\n│                             │incididunt ut labore et dolore magna   │\n│                             │aliqua. Ut enim ad minim veniam, quis  │\n│                             │nostrud exercitation ullamco laboris   │\n│                             │nisi ut aliquip ex ea commodo          │\n│                             │consequat. Duis aute irure dolor in    │\n│                             │reprehenderit in voluptate velit esse  │\n│                             │cillum dolore eu fugiat nulla pariatur.│\n│                             │Excepteur sint occaecat cupidatat non  │\n│                             │proident, sunt in culpa qui officia    │\n│                             │deserunt mollit anim id est laborum.   │\n└─────────────────────────────┴───────────────────────────────────────┘\n```\n\nIn the example above, what does not appear is the fact the the first row\nis using bold text.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frabbitmq%2Fstdout_formatter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frabbitmq%2Fstdout_formatter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frabbitmq%2Fstdout_formatter/lists"}