{"id":29170199,"url":"https://github.com/manifoldco/ansiwrap","last_synced_at":"2025-07-01T12:39:37.337Z","repository":{"id":107299860,"uuid":"80029915","full_name":"manifoldco/ansiwrap","owner":"manifoldco","description":"ANSI escape sequence / unicode aware text wrapping for Go","archived":false,"fork":false,"pushed_at":"2020-01-12T13:19:33.000Z","size":460,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-05-08T08:03:23.305Z","etag":null,"topics":["ansi-colors","ansi-escape-sequence","cli"],"latest_commit_sha":null,"homepage":"https://godoc.org/github.com/manifoldco/ansiwrap","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/manifoldco.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-01-25T15:57:47.000Z","updated_at":"2023-09-26T14:28:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"5f453fdf-7820-476b-853e-0fd465fb100a","html_url":"https://github.com/manifoldco/ansiwrap","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/manifoldco/ansiwrap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manifoldco%2Fansiwrap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manifoldco%2Fansiwrap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manifoldco%2Fansiwrap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manifoldco%2Fansiwrap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/manifoldco","download_url":"https://codeload.github.com/manifoldco/ansiwrap/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manifoldco%2Fansiwrap/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262964046,"owners_count":23391938,"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":["ansi-colors","ansi-escape-sequence","cli"],"created_at":"2025-07-01T12:39:25.277Z","updated_at":"2025-07-01T12:39:37.226Z","avatar_url":"https://github.com/manifoldco.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `ansiwrap`\n\nANSI escape sequence / unicode aware text wrapping for Go.\n\n[Code of Conduct](./CODE_OF_CONDUCT.md) |\n[Contribution Guidelines](./.github/CONTRIBUTING.md)\n\n[![GitHub release](https://img.shields.io/github/tag/manifoldco/ansiwrap.svg?label=latest)](https://github.com/manifoldco/ansiwrap/releases)\n[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://godoc.org/github.com/manifoldco/ansiwrap)\n[![Travis](https://img.shields.io/travis/manifoldco/ansiwrap/master.svg)](https://travis-ci.org/manifoldco/ansiwrap)\n[![Go Report Card](https://goreportcard.com/badge/github.com/manifoldco/ansiwrap)](https://goreportcard.com/report/github.com/manifoldco/ansiwrap)\n[![License](https://img.shields.io/badge/license-BSD-blue.svg)](./LICENSE.md)\n\n## Why `ansiwrap`?\n\n![](./.img/ansiwrap_comparison.png)\n\n\u003e Old text wrappers can't handle ANSI escape sequence formatting,\n\u003e but `ansiwrap` knows what to do!\n\n## Features\n\n- ANSI escape sequence aware\n- unicode aware\n- Greedy and balanced text wrapping\n- Flexible indenting\n\n## Example\n\n### Screenshot\n\n![](./.img/cupcake_ipsum.png)\n\n### Code\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/manifoldco/ansiwrap\"\n)\n\n// text including ANSI formatting\nconst text = \"Sweet jujubes tootsie roll cotton candy lollipop. Marzipan donut\" +\n\t\" gummies tiramisu fruitcake sesame snaps icing danish.  Ice cream sesame snaps\" +\n\t\" candy lemon drops toffee oat cake pastry gummies soufflé. Candy chocolate cake\" +\n\t\" ice cream tiramisu \\033[35mmarshmallow\\033[0m sesame snaps\" +\n\t\" \\033[35mmarshmallow\\033[0m tootsie roll. Pastry cupcake biscuit. Tiramisu\" +\n\t\" chocolate sweet sugar plum. Pastry cupcake tart chocolate cake gingerbread\" +\n\t\" toffee cake gummi bears oat cake. Icing ice cream danish danish bonbon\" +\n\t\" \\033[35mmarshmallow\\033[0m \\033[35mmarshmallow\\033[0m gummi bears chocolate bar.\" +\n\t\" Sesame snaps icing chocolate liquorice macaroon sugar plum macaroon ice cream.\" +\n\t\" Tootsie roll sugar plum oat cake jelly toffee. Sweet cotton candy candy\" +\n\t\" caramels carrot cake cotton candy tiramisu gummies cheesecake. Sweet marzipan\" +\n\t\" topping jujubes sesame snaps. Cupcake cake jelly beans candy canes ice cream\" +\n\t\" jelly gummies.\"\n\nfunc main() {\n\t// Add your favorite ANSI escape code library, and terminal width reporter.\n\n\t// A bold and blue label\n\tlabel := \"\\033[1;34mCupcake ipsum:\\033[0m \"\n\n\t// count the printable characters in label\n\trc := ansiwrap.RuneCount(label)\n\n\t// Wrap the text to 80 chars, aligning with the end of the label\n\t// Lines are wrapped with minimal raggedness, as the text is long enough\n\t// to have ansiwrap choose the Balanced algorithm.\n\tfmt.Println(ansiwrap.WrapIndent(label+text, 70, 0, rc))\n}\n```\n\nFor more examples and documentation, see the\n[GoDoc reference](https://godoc.org/github.com/manifoldco/ansiwrap)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanifoldco%2Fansiwrap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmanifoldco%2Fansiwrap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanifoldco%2Fansiwrap/lists"}