{"id":24983647,"url":"https://github.com/posthtml/posthtml-tidy","last_synced_at":"2025-04-11T20:51:22.934Z","repository":{"id":63279019,"uuid":"52650119","full_name":"posthtml/posthtml-tidy","owner":"posthtml","description":"Tidy Plugin","archived":false,"fork":false,"pushed_at":"2017-02-10T17:41:52.000Z","size":5,"stargazers_count":9,"open_issues_count":2,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-29T21:06:08.250Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/posthtml.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}},"created_at":"2016-02-27T04:37:20.000Z","updated_at":"2023-08-10T06:14:43.000Z","dependencies_parsed_at":"2022-11-16T06:46:34.535Z","dependency_job_id":null,"html_url":"https://github.com/posthtml/posthtml-tidy","commit_stats":null,"previous_names":["michael-ciniawsky/posthtml-tidy"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-tidy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-tidy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-tidy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-tidy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/posthtml","download_url":"https://codeload.github.com/posthtml/posthtml-tidy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247157295,"owners_count":20893227,"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":"2025-02-04T09:19:59.497Z","updated_at":"2025-04-11T20:51:22.911Z","avatar_url":"https://github.com/posthtml.png","language":"JavaScript","readme":"# HTML Tidy for PostHTML\n\n[HTML Tidy](http://html-tidy.org) corrects and cleans up HTML and XML documents by fixing markup errors and upgrading legacy code to modern standards.\n\n## Install\n\n```bash\n(sudo) npm i -D posthtml-tidy\n```\n\n## Usage\n### Options\n#### log   [Boolean]\n\nBoolean option which logs tidied html to the console.\nBy default no output is logged.\n\n#### rules [Object]\n\nIf no rules set, tidy will use it's default setup.\nFor rules take a look at the [Quick Reference](http://api.html-tidy.org/tidy/quickref_5.1.25.html).\nMulti-word rules separated with a hyphen should be used with camelCase.\n\n```js\nconst tidy = require('posthtml-tidy')({\n  log: true,\n  rules: {\n    doctype: 'omit',\n    hideComments: true,\n    dropEmptyElements: true\n    // more options...\n  }\n})\n```\n#### Input\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n\n\u003chead\u003e\n  \u003cmeta charset=\"utf-8\"\u003e\n  \u003ctitle\u003ePostHTML Tidy\u003c/title\u003e\n\u003c/head\u003e\n\n\u003cbody\u003e\n  \u003c!-- Bad format --\u003e\n  \u003ch1\u003eWell formatted\u003c/h1\u003e\n  \u003ch1\u003eBad formatted\u003c/h4\u003e\n  \u003ch6\u003eEven worse formatted\u003c/h1\n\n  \u003cdiv\u003e\u003c/div\u003e\n\u003c/body\u003e\n\n\u003c/html\u003e\n```\n#### Output\n```html\n\u003chtml\u003e\n\u003chead\u003e\n\n\u003cmeta charset=\"utf-8\"\u003e\n\u003ctitle\u003ePostHTML Tidy\u003c/title\u003e\n\n\u003c/head\u003e\n\n\u003cbody\u003e\n\n\u003ch1\u003eWell formatted\u003c/h1\u003e\n\u003ch1\u003eBad formatted\u003c/h1\u003e\n\u003ch6\u003eEven worse formatted\u003c/h6\u003e\n\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n### Example using Node API\n\nFor general usage and build process integration see [PostHTML Docs](https://github.com/posthtml/posthtml#usage)\n\n```js\nconst fs = require('fs')\n\nconst posthtml = require('posthtml')\n\nconst tidy = require('posthtml-tidy')(/* options */)\n\nlet html = fs.readFileSync('./index.html', 'utf8')\n\nposthtml([ tidy ])\n  .process(html)\n  .then(result =\u003e console.log(result.html))\n```\n#### Input\n```html\n\u003ch1\u003eWell formatted\u003c/h1\u003e\n\u003ch1\u003eBad formatted\u003c/h4\u003e\n\u003ch6\u003eEven worser formatted\u003c/h1\n```\n#### Output\n```html\n\u003ch1\u003eWell formatted\u003c/h1\u003e\n\u003ch1\u003eBad formatted\u003c/h1\u003e\n\u003ch6\u003eEven worser formatted\u003c/h6\u003e\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposthtml%2Fposthtml-tidy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fposthtml%2Fposthtml-tidy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposthtml%2Fposthtml-tidy/lists"}