{"id":29926637,"url":"https://github.com/ecomfe/htmlcs","last_synced_at":"2025-09-10T19:44:58.568Z","repository":{"id":23692482,"uuid":"27064365","full_name":"ecomfe/htmlcs","owner":"ecomfe","description":"HTML Code Style","archived":false,"fork":false,"pushed_at":"2018-12-18T06:23:29.000Z","size":617,"stargazers_count":46,"open_issues_count":19,"forks_count":8,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-07-02T08:10:43.498Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/ecomfe.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":"2014-11-24T06:47:42.000Z","updated_at":"2020-12-18T03:59:19.000Z","dependencies_parsed_at":"2022-09-02T05:40:54.082Z","dependency_job_id":null,"html_url":"https://github.com/ecomfe/htmlcs","commit_stats":null,"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"purl":"pkg:github/ecomfe/htmlcs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecomfe%2Fhtmlcs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecomfe%2Fhtmlcs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecomfe%2Fhtmlcs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecomfe%2Fhtmlcs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ecomfe","download_url":"https://codeload.github.com/ecomfe/htmlcs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecomfe%2Fhtmlcs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268392180,"owners_count":24243297,"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","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-08-02T12:42:22.158Z","updated_at":"2025-08-02T12:42:57.654Z","avatar_url":"https://github.com/ecomfe.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"htmlcs\n========\n\n[![Build Status](https://img.shields.io/travis/ecomfe/htmlcs.svg?style=flat)](http://travis-ci.org/ecomfe/htmlcs)\n[![NPM version](https://img.shields.io/npm/v/htmlcs.svg?style=flat)](https://www.npmjs.com/package/htmlcs)\n[![Coverage Status](https://img.shields.io/coveralls/ecomfe/htmlcs.svg?style=flat)](https://coveralls.io/r/ecomfe/htmlcs)\n[![Dependencies](https://img.shields.io/david/ecomfe/htmlcs.svg?style=flat)](https://david-dm.org/ecomfe/htmlcs)\n[![DevDependencies](https://img.shields.io/david/dev/ecomfe/htmlcs.svg?style=flat)](https://david-dm.org/ecomfe/htmlcs)\n\n\nHTML code style check \u0026 format tool.\n\n### Install\n\n\tnpm i -g htmlcs\n\n### Usage\n\n* in CLI\n\n\t```shell\n\tUsage: htmlcs \u003ccommand\u003e [options] [target...]\n\n\tCommands:\n\t  hint    Do hint given file(s)\n\t  format  Do format given file(s)\n\n\tOptions:\n\t  -h, --help      Show help                                            [boolean]\n\t  -c, --config    Path to custom configuration file.                    [string]\n\t  --diff          Check code style and output char diff.               [boolean]\n\t  -i, --in-place  Edit input files in place; use with care!            [boolean]\n\t  -v, --version   Show version number                                  [boolean]\n\n\tExamples:\n\t  htmlcs hint foo.html               do hint foo.html\n\t  htmlcs hint foo.html bar.html      do hint foo.html \u0026 bar.html\n\t  htmlcs hint ./                     do hint html files under ./\n\t  htmlcs format foo.html             do format foo.html\n\t  htmlcs format --diff foo.html      do format foo.html \u0026 show diff result\n\t  htmlcs format --in-place foo.html  do format foo.html \u0026 write file in place\n\n\t```\n\n* in Node.js / browser (with [browserify](https://github.com/substack/node-browserify))\n\n\t* hint file\n\n\t\t```javascript\n\t\tvar htmlcs = require('htmlcs');\n\t\tvar result = htmlcs.hintFile(filePath);\n\t\t```\n\n\t* hint code (string)\n\n\t\t```javascript\n\t\tvar htmlcs = require('htmlcs');\n\t\tvar result = htmlcs.hint(code);\n\t\t// Or\n\t\thtmlcs.hintAsync(code).then(\n\t\t\tresult =\u003e { /* ... */ }\n\t\t);\n\t\t```\n\n\t* use hint result\n\n\t\t```javascript\n\t\tresult.forEach(function(item){\n\t\t    console.log(\n\t\t        '[%s] line %d, column %d: %s (%s, %s)',\n\t\t        item.type,\n\t\t        item.line,\n\t\t        item.column,\n\t\t        item.message,\n\t\t        item.rule,\n\t\t        item.code\n\t\t    );\n\t\t});\n\t\t```\n\n\t* format file\n\n\t\t```javascript\n\t\tvar htmlcs = require('htmlcs');\n\t\tconsole.log(htmlcs.formatFile(filePath));\n\t\t```\n\n\t* format code (string)\n\n\t\t```javascript\n\t\tvar htmlcs = require('htmlcs');\n\t\tconsole.log(htmlcs.format(code));\n\t\t// Or\n\t\thtmlcs.formatAsync(code).then(\n\t\t\tresult =\u003e console.log(result)\n\t\t);\n\t\t```\n\n\t* add rule\n\n\t\t```javascript\n\t\tvar htmlcs = require('htmlcs');\n\t\thtmlcs.addRule({\n\t\t    name: 'test-rule',\n\t\t    desc: 'Just a test rule.',\n\t\t    lint: function (getCfg, document, reporter) {\n\t\t        reporter.warn(\n\t\t            1,\n\t\t            '099',\n\t\t            'This is a test waring!'\n\t\t        );\n\t\t    }\n\t\t});\n\t\tvar result = htmlcs.hint(code);\n\t\t```\n\n* with Gulp/Grunt\n\n\tThere is no official Gulp/Grunt plugin yet. We recommend [fecs](https://github.com/ecomfe/fecs), which uses htmlcs to hint HTML code and provides a wealth of tools.\n\n\t- [fecs-gulp](https://github.com/ecomfe/fecs-gulp)\n\n\t- [fecs-grunt](https://github.com/ecomfe/fecs-grunt)\n\n### Rules \u0026 Codes\n\n[lib/rules/](./lib/rules/)\n\n[rule map](./lib/default/rule-map.json)\n\n### Config\n\n* default: [lib/default/.htmlcsrc](./lib/default/htmlcsrc)\n\n* custom:\n\n\tCustom rule file (.htmlcsrc) can be placed in the same/parent directory of target file, or the `~/` directory.\n\n\tIf found in neither paths, the default config will be used.\n\n* inline:\n\n\t- disable\n\n\t\t```html\n\t\t\u003c!-- htmlcs-disable --\u003e\n\t\t\u003c!-- htmlcs-disable img-alt --\u003e\n\t\t\u003c!-- htmlcs-disable img-alt, img-src, attr-value-double-quotes --\u003e\n\t\t```\n\n\t- enable\n\n\t\t```html\n\t\t\u003c!-- htmlcs-enable --\u003e\n\t\t\u003c!-- htmlcs-enable img-alt --\u003e\n\t\t\u003c!-- htmlcs-enable img-alt, img-src, attr-value-double-quotes --\u003e\n\t\t```\n\n\t- config\n\n\t\t```html\n\t\t\u003c!-- htmlcs img-width-height: true --\u003e\n\t\t\u003c!-- htmlcs img-width-height: true, indent-char: \"tab\" --\u003e\n\t\t```\n\n### Relative third-party tools\n\n* [grunt-htmlcs](https://github.com/RRMoelker/grunt-htmlcs)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fecomfe%2Fhtmlcs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fecomfe%2Fhtmlcs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fecomfe%2Fhtmlcs/lists"}