{"id":13879854,"url":"https://github.com/threedaymonk/htmlbeautifier","last_synced_at":"2025-07-16T16:30:25.195Z","repository":{"id":596285,"uuid":"231473","full_name":"threedaymonk/htmlbeautifier","owner":"threedaymonk","description":"A normaliser/beautifier for HTML that also understands embedded Ruby. Ideal for tidying up Rails templates.","archived":false,"fork":false,"pushed_at":"2024-02-13T13:24:28.000Z","size":161,"stargazers_count":361,"open_issues_count":18,"forks_count":59,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-07-15T00:11:39.258Z","etag":null,"topics":[],"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/threedaymonk.png","metadata":{"files":{"readme":"README.md","changelog":"History.txt","contributing":null,"funding":null,"license":"COPYING.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}},"created_at":"2009-06-19T15:28:06.000Z","updated_at":"2025-07-13T16:17:52.000Z","dependencies_parsed_at":"2023-07-05T15:02:04.196Z","dependency_job_id":"545b70af-1650-4a33-94b6-1a755cfa06e4","html_url":"https://github.com/threedaymonk/htmlbeautifier","commit_stats":{"total_commits":160,"total_committers":16,"mean_commits":10.0,"dds":"0.23750000000000004","last_synced_commit":"d3279191d6182da02dbdcf273d587e429f467e07"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/threedaymonk/htmlbeautifier","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/threedaymonk%2Fhtmlbeautifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/threedaymonk%2Fhtmlbeautifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/threedaymonk%2Fhtmlbeautifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/threedaymonk%2Fhtmlbeautifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/threedaymonk","download_url":"https://codeload.github.com/threedaymonk/htmlbeautifier/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/threedaymonk%2Fhtmlbeautifier/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265412602,"owners_count":23760842,"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":[],"created_at":"2024-08-06T08:02:35.995Z","updated_at":"2025-07-16T16:30:24.889Z","avatar_url":"https://github.com/threedaymonk.png","language":"Ruby","funding_links":[],"categories":["Ruby","Programming Languages"],"sub_categories":[],"readme":"# HTML Beautifier\n\nA normaliser/beautifier for HTML that also understands embedded Ruby.\nIdeal for tidying up Rails templates.\n\n## What it does\n\n* Normalises hard tabs to spaces (or vice versa)\n* Removes trailing spaces\n* Indents after opening HTML elements\n* Outdents before closing elements\n* Collapses multiple whitespace\n* Indents after block-opening embedded Ruby (if, do etc.)\n* Outdents before closing Ruby blocks\n* Outdents elsif and then indents again\n* Indents the left-hand margin of JavaScript and CSS blocks to match the\n  indentation level of the code\n\n## Usage\n\n### From the command line\n\nTo update files in-place:\n\n``` sh\n$ htmlbeautifier file1.html.erb [file2.html.erb ...]\n```\n\nor to operate on standard input and output:\n\n``` sh\n$ htmlbeautifier \u003c untidy.html.erb \u003e formatted.html.erb\n```\n\n### In your code\n\n```ruby\nrequire 'htmlbeautifier'\n\nbeautiful = HtmlBeautifier.beautify(untify_html_string)\n```\n\nYou can also specify how to indent (the default is two spaces):\n\n```ruby\nbeautiful = HtmlBeautifier.beautify(untidy_html_string, indent: \"\\t\")\n```\n\n## Installation\n\nThis is a Ruby gem.\nTo install the command-line tool (you may need `sudo`):\n\n```sh\n$ gem install htmlbeautifier\n```\n\nTo use the gem with Bundler, add to your `Gemfile`:\n\n```ruby\ngem 'htmlbeautifier'\n```\n\n## Contributing\n\n1. Follow [these guidelines][git-commit] when writing commit messages (briefly,\n   the first line should begin with a capital letter, use the imperative mood,\n   be no more than 50 characters, and not end with a period).\n2. Include tests.\n\n[git-commit]:http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthreedaymonk%2Fhtmlbeautifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthreedaymonk%2Fhtmlbeautifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthreedaymonk%2Fhtmlbeautifier/lists"}