{"id":17749285,"url":"https://github.com/jaynetics/repper","last_synced_at":"2025-05-12T13:23:58.568Z","repository":{"id":57677983,"uuid":"490438707","full_name":"jaynetics/repper","owner":"jaynetics","description":"Regexp pretty printer and formatter for Ruby","archived":false,"fork":false,"pushed_at":"2023-05-14T10:34:03.000Z","size":51,"stargazers_count":17,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-11T23:04:46.428Z","etag":null,"topics":["code-formatter","formatter","pretty-printer","regexp","regular-expression","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/jaynetics.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","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":"2022-05-09T20:43:12.000Z","updated_at":"2024-11-26T05:21:30.000Z","dependencies_parsed_at":"2024-10-26T12:49:42.914Z","dependency_job_id":"0b25d73e-041c-4969-bbf0-fa6505b8a071","html_url":"https://github.com/jaynetics/repper","commit_stats":{"total_commits":13,"total_committers":1,"mean_commits":13.0,"dds":0.0,"last_synced_commit":"9ebcfaf95a82f720637cfec0becaed17a020001e"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaynetics%2Frepper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaynetics%2Frepper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaynetics%2Frepper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaynetics%2Frepper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaynetics","download_url":"https://codeload.github.com/jaynetics/repper/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253745599,"owners_count":21957409,"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":["code-formatter","formatter","pretty-printer","regexp","regular-expression","ruby"],"created_at":"2024-10-26T11:06:56.448Z","updated_at":"2025-05-12T13:23:58.549Z","avatar_url":"https://github.com/jaynetics.png","language":"Ruby","readme":"\u003cimg alt='Rapper necklace with dollar pendant' src='https://user-images.githubusercontent.com/10758879/167485870-5c49284d-a783-453e-8be0-a3597c2ef97c.png' height='64' align='right' /\u003e\n\n# Repper\n\n[![Gem Version](https://badge.fury.io/rb/repper.svg)](http://badge.fury.io/rb/repper)\n[![Build Status](https://github.com/jaynetics/repper/actions/workflows/main.yml/badge.svg)](https://github.com/jaynetics/repper/actions)\n[![Coverage](https://codecov.io/gh/jaynetics/repper/branch/main/graph/badge.svg?token=4C6EKINE4B)](https://codecov.io/gh/jaynetics/repper)\n\nRepper is a regular expression pretty printer and formatter for Ruby.\n\n## Installation\n\n`gem install repper`, or add it to your `Gemfile`.\n\n## Usage\n\n`repper` can be integrated into the REPL (e.g. IRB) through core extensions for Regexp pretty-printing, integrated into editors to format Regexps, or called manually.\n\nThere are also a few customization options.\n\n### REPL integration\n\n#### Via Regexp#inspect (recommended)\n\n`require 'repper/core_ext/regexp'` in your `~/.irbrc` or `~/.pryrc` to override `Regexp#inspect` and automatically use `repper` to display Regexps:\n\n\u003cimg width=\"475\" alt=\"screenshot1\" src=\"https://user-images.githubusercontent.com/10758879/167719748-60f4013a-c8d4-4a62-843a-d9f27057bcd3.png\"\u003e\n\n#### Via Kernel#pp\n\nAlternatively, `require 'repper/core_ext/kernel'` to make the `pp` command give nicer output for Regexps (which will look like above by default).\n\n### Editor integration\n\nUse [vscode-repper](https://github.com/jaynetics/vscode-repper) to format Regexps in VSCode.\n\n![vscode-repper](https://user-images.githubusercontent.com/10758879/170892739-e2f408f2-e239-4b13-8d28-c14fb7a9dbb9.gif)\n\n### Using Repper manually\n\n```ruby\nRepper.call(/foo/)   # pretty prints the given Regexp and returns nil\nRepper.render(/foo/) # returns the pretty print String\n```\n\n### Customization\n\n#### Customizing the format\n\nMultiple formats are available out of the box:\n\n- `:annotated` is the default, verbose format, shown above\n- `:inline` adds only colorization and does not restructure the Regexp\n- `:structured` is like `:annotated`, just without annotations\n- `:x` (or `:extended`) returns a lightly formatted but equivalent Regexp\n  - this format is used for the repper executable and [vscode-repper](https://github.com/jaynetics/vscode-repper)\n\nYou can change the format globally:\n\n```ruby\nRepper.format = :structured\n```\n\nOr pick a format on a case-by-case basis:\n\n\u003cimg width=\"711\" alt=\"screenshot2\" src=\"https://user-images.githubusercontent.com/10758879/167719567-ae8ee42f-839e-4ce4-af56-a139044d3436.png\"\u003e\n\nOr create your own format:\n\n```ruby\nrequire 'csv'\n\ncsv_format = -\u003e(tokens, _theme) { tokens.map(\u0026:text).to_csv }\nRepper.render(/re[\\p{pe}\\r]$/, format: csv_format)\n=\u003e \"/,re,[,\\\\p{pe},\\\\r,],$,/\\n\"\n```\n\n#### Customizing the colors\n\nThe color theme can also be set globally or passed on call:\n\n```ruby\nRepper.theme = :monokai # a nicer theme, if the terminal supports it\n```\n\n\u003cimg width=\"478\" alt=\"screenshot3\" src=\"https://user-images.githubusercontent.com/10758879/167719807-9170ba92-48d1-4669-a05d-a72f962b961d.png\"\u003e\n\n```ruby\nRepper.call(/foo/, theme: nil) # render without colors\n```\n\nOr create your own theme - you can use all colors supported by the [`rainbow` gem](https://github.com/sickill/rainbow).\n\n```ruby\nRepper.theme = {\n  group:   :green,\n  set:     :red,\n  default: :white,\n}\n```\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/jaynetics/repper.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaynetics%2Frepper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaynetics%2Frepper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaynetics%2Frepper/lists"}