{"id":22423308,"url":"https://github.com/prantlf/grunt-tidy-html5","last_synced_at":"2025-03-27T05:40:36.309Z","repository":{"id":57255834,"uuid":"122864284","full_name":"prantlf/grunt-tidy-html5","owner":"prantlf","description":"Grunt task for checking and fixing HTML files using HTML Tidy (tidy-html5)","archived":false,"fork":false,"pushed_at":"2019-03-19T18:02:48.000Z","size":144,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-26T09:16:24.061Z","etag":null,"topics":["accessibility","grunt-task","html","html-tidy","html5"],"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/prantlf.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":"2018-02-25T18:37:08.000Z","updated_at":"2019-03-19T18:00:43.000Z","dependencies_parsed_at":"2022-09-04T23:01:35.699Z","dependency_job_id":null,"html_url":"https://github.com/prantlf/grunt-tidy-html5","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prantlf%2Fgrunt-tidy-html5","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prantlf%2Fgrunt-tidy-html5/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prantlf%2Fgrunt-tidy-html5/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prantlf%2Fgrunt-tidy-html5/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prantlf","download_url":"https://codeload.github.com/prantlf/grunt-tidy-html5/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245791898,"owners_count":20672667,"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":["accessibility","grunt-task","html","html-tidy","html5"],"created_at":"2024-12-05T18:09:57.838Z","updated_at":"2025-03-27T05:40:36.290Z","avatar_url":"https://github.com/prantlf.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# grunt-tidy-html5\n[![NPM version](https://badge.fury.io/js/grunt-tidy-html5.png)](http://badge.fury.io/js/grunt-tidy-html5)\n[![Build Status](https://travis-ci.org/prantlf/grunt-tidy-html5.png)](https://travis-ci.org/prantlf/grunt-tidy-html5)\n[![Coverage Status](https://coveralls.io/repos/prantlf/grunt-tidy-html5/badge.svg)](https://coveralls.io/r/prantlf/grunt-tidy-html5)\n[![Dependency Status](https://david-dm.org/prantlf/grunt-tidy-html5.svg)](https://david-dm.org/prantlf/grunt-tidy-html5)\n[![devDependency Status](https://david-dm.org/prantlf/grunt-tidy-html5/dev-status.svg)](https://david-dm.org/prantlf/grunt-tidy-html5#info=devDependencies)\n[![devDependency Status](https://david-dm.org/prantlf/grunt-tidy-html5/peer-status.svg)](https://david-dm.org/prantlf/grunt-tidy-html5#info=peerDependencies)\n[![Code Climate](https://codeclimate.com/github/prantlf/grunt-tidy-html5/badges/gpa.svg)](https://codeclimate.com/github/prantlf/grunt-tidy-html5)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/989cdb4f326e4340afca43311aa26f49)](https://www.codacy.com/app/prantlf/grunt-tidy-html5?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=prantlf/grunt-tidy-html5\u0026amp;utm_campaign=Badge_Grade)\n[![Built with Grunt](https://cdn.gruntjs.com/builtwith.png)](http://gruntjs.com/)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n\n[![NPM Downloads](https://nodei.co/npm/grunt-tidy-html5.png?downloads=true\u0026stars=true)](https://www.npmjs.com/package/grunt-tidy-html5)\n\nThis module provides a grunt multi-task for checking and fixing HTML files\nusing [tidy-html5], wrapped for Node.js by [node-libtidy]. See the official\n[HTML Tidy] pages for more information.\n\n## Installation\n\nYou need [node \u003e= 4][node], [npm] and [grunt \u003e= 1][Grunt] installed\nand your project build managed by a [Gruntfile] with the necessary modules\nlisted in [package.json]. If you haven't used Grunt before, be sure to\ncheck out the [Getting Started] guide, as it explains how to create a\nGruntfile as well as install and use Grunt plugins.\n\nInstall the Grunt task:\n\n```shell\n$ npm install grunt-tidy-html5 --save-dev\n```\n\n## Configuration\n\nAdd the `tidy-html5` entry with the HTML Tidy task configuration to the\noptions of the `grunt.initConfig` method:\n\n```js\ngrunt.initConfig({\n  'tidy-html5': {\n    test: {\n      src: ['*.html']\n    }\n  }\n});\n```\n\nThen, load the plugin:\n\n```javascript\ngrunt.loadNpmTasks('grunt-tidy-html5');\n```\n\n## Build\n\nCall the HTML Tidy task:\n\n```shell\n$ grunt tidy-html5\n```\n\nor integrate it to your build sequence in `Gruntfile.js`:\n\n```js\ngrunt.registerTask('default', ['tidy-html5', ...]);\n```\n\nWarnings about invalid parts of the HTML markup will be logged on the console,\nif the `quiet` mode is not enabled. If there are any, unless the task\nexecution is `force`d, the task will make Grunt fail.\n\n## Customizing\n\nDefault behaviour of the task can be tweaked by the task options; these\nare the defaults:\n\n```js\ngrunt.initConfig({\n  tidy-html5: {\n    task: {\n      options: {\n        force: false,\n        quiet: false,\n        report: '',\n        ignoreMissing: false,\n        tidyOptions: {}\n      },\n      src: ...\n    }\n  }\n});\n```\n\n### Options\n\n#### force\nType: `Boolean`\nDefault: `false`\n\nSuppresses reporting the failure to Grunt and thus stopping execution\nof further tasks, if set to `true`.\n\n#### quiet\nType: `Boolean`\nDefault: `false`\n\nSuppresses printing of errors and warnings about problems found in input\nfiles on the console. if set to `true`.\n\n#### report\nType: `String`\nDefault: ''\n\nPath to the file, where the report will be written. If specified, the file\nwill contain an array of objects describing every problem found, for example:\n\n```json\n[\n  {\n    \"type\": \"warning\",\n    \"firstColumn\": 1,\n    \"lastColumn\": 1,\n    \"lastLine\": 1,\n    \"message\": \"missing \u003c!DOCTYPE\u003e declaration\",\n    \"extract\": \"\u003chtml\u003e\u003c/html\u003e\",\n    \"hiliteStart\": 0,\n    \"hiliteLength\": 0,\n    \"file\":\"test/work/incomplete.html\"\n  }\n]\n```\n\nThe file will have the JSON format compatible with the JSON report produced by\n[grunt-html], which is backed up by gthe [Nu Html Checker (v.Nu)]. Marking the\ninvalid code excerps is not supported.\n\nThe JSON report file can be converted to a HTML report file using\n[grunt-html-html-report-converter].\n\n#### ignoreMissing\nType: `Boolean`\nDefault: `false`\n\nIf the `src` property does not point to any files, or if it is missing,\nthe task will make the Grunt run fail. If you set the `ignoreMissing`\noption to `true`, Grunt will continue executing other tasks.\n\n#### tidyOptions\nType: `Object`\nDefault: `{}`\n\nObject passed to the [TidyDoc].[options] property to set [libtidy options].\nAny of [all HTML Tidy options] can be used as a property key and its value\nas a property value in the object.\n\n### More Usage Examples\n\n```js\n'tidy-html5': {\n  accessibility: {\n    options: {\n      report: 'output/report.json',\n      tidyOptions: {\n        'accessibility-check': 2\n      }\n    },\n    src: ['input/*.html']\n  }\n}\n```\n\n## Contributing\n\nIn lieu of a formal styleguide, take care to maintain the existing coding\nstyle. Add unit tests for any new or changed functionality. Lint and test\nyour code using Grunt.\n\n## Release History\n\n * 2018-04-27   v1.0.0   Dropped support of Node.js 4\n * 2018-03-06   v0.1.0   Write report to a file as JSON\n * 2018-02-26   v0.0.1   Initial release\n\n## License\n\nCopyright (c) 2018-2019 Ferdinand Prantl\n\nLicensed under the MIT license.\n\n[HTML Tidy]: http://www.html-tidy.org/\n[tidy-html5]: https://github.com/htacg/tidy-html5\n[node-libtidy]: https://github.com/gagern/node-libtidy\n[node]: http://nodejs.org\n[npm]: http://npmjs.org\n[package.json]: https://docs.npmjs.com/files/package.json\n[Grunt]: https://gruntjs.com\n[Gruntfile]: http://gruntjs.com/sample-gruntfile\n[Getting Gtarted]: https://github.com/gruntjs/grunt/wiki/Getting-started\n[TidyDoc]: https://github.com/gagern/node-libtidy/blob/master/API.md#TidyDoc\n[options]: https://github.com/gagern/node-libtidy/blob/master/API.md#TidyDoc.options\n[libtidy options]: https://github.com/gagern/node-libtidy/blob/master/README.md#options\n[all HTML Tidy options]: http://api.html-tidy.org/tidy/quickref_5.4.0.html\n[grunt-html]: https://github.com/jzaefferer/grunt-html\n[Nu Html Checker (v.Nu)]: https://validator.github.io/validator/\n[grunt-html-html-report-converter]: https://github.com/prantlf/grunt-html-html-report-converter\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprantlf%2Fgrunt-tidy-html5","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprantlf%2Fgrunt-tidy-html5","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprantlf%2Fgrunt-tidy-html5/lists"}