{"id":16350542,"url":"https://github.com/kevinkace/posthtml-pseudo","last_synced_at":"2025-03-21T00:30:50.528Z","repository":{"id":37677343,"uuid":"67358280","full_name":"kevinkace/posthtml-pseudo","owner":"kevinkace","description":"PostHTML plugin to add pseudo selector class names to elements, like :first-child/:last-child.","archived":false,"fork":false,"pushed_at":"2024-07-12T01:37:35.000Z","size":887,"stargazers_count":8,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-26T07:36:19.920Z","etag":null,"topics":["css","email","html","newsletters"],"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/kevinkace.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-09-04T17:16:25.000Z","updated_at":"2023-01-28T08:49:54.000Z","dependencies_parsed_at":"2024-10-13T06:33:39.144Z","dependency_job_id":"ebe49412-1cc6-4149-b272-cf798b424be5","html_url":"https://github.com/kevinkace/posthtml-pseudo","commit_stats":{"total_commits":153,"total_committers":7,"mean_commits":"21.857142857142858","dds":0.4509803921568627,"last_synced_commit":"ef35662ba557b0edd1fed29ec2ab6eea374de876"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinkace%2Fposthtml-pseudo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinkace%2Fposthtml-pseudo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinkace%2Fposthtml-pseudo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinkace%2Fposthtml-pseudo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kevinkace","download_url":"https://codeload.github.com/kevinkace/posthtml-pseudo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221810346,"owners_count":16884097,"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":["css","email","html","newsletters"],"created_at":"2024-10-11T01:05:20.982Z","updated_at":"2024-10-28T08:55:08.577Z","avatar_url":"https://github.com/kevinkace.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# posthtml-pseudo\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n![super awesome][super-badge]\n\nA [PostHTML](https://github.com/posthtml/posthtml) plugin to add [pseudo classes](https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes) to elements within `\u003cbody\u003e`, eg `:first-child`/`:last-child`.\n\nBefore:\n```html\n\u003chtml\u003e\n    \u003cbody\u003e\n        \u003cdiv\u003eone\u003c/div\u003e\n        \u003cdiv\u003etwo\u003c/div\u003e\n        \u003cdiv\u003ethree\u003c/div\u003e\n    \u003c/body\u003e\n\u003c/html\u003e\n```\n\nAfter:\n```html\n\u003chtml\u003e\n    \u003cbody\u003e\n        \u003cdiv class=\":first-child\"\u003eone\u003c/div\u003e\n        \u003cdiv\u003etwo\u003c/div\u003e\n        \u003cdiv class=\":last-child\"\u003ethree\u003c/div\u003e\n    \u003c/body\u003e\n\u003c/html\u003e\n```\n\n:point_right: Check out [postcss-pseudo-classes](https://github.com/giuseppeg/postcss-pseudo-classes) for the other side of the equation.\n\n:pencil: **Note on supported classes**: Pseudo classes dependent on input values (`:valid`, `:invalid`, ...), browser history (`:visted`, `:link`, ...), interaction (`:hover`, `:focus:`), parameters (`:nth-child()`, `:lang()`, ...), page url (`:target`) or require JS (`:indeterminate`), have been excluded. See [support list](#pseudo-class-names).\n\n## Options\n\nOptions config has two properties \u0026mdash; `include` and `exclude` \u0026mdash; to define which psuedo class names to add, and which tags to add them to. Both `include.classNames` and `exclude.classNames` can be:\n\n- a string of a [class name group](#class-name-groups)\n- a string of a class name (`/^:\\S+/`, from those in the `all` group)\n- an array of class name groups and/or class names\n\n### Example Options Config\n\nThis config adds all supported pseudo class names to all appropriate elements using their default class names.\n\n```js\nlet config = {\n    include : {\n        classNames : \"all\" // all group\n    }\n};\n```\n\nHere's something more complex, adding only two class names but only to elements that aren't `div`, `table` or `form`.\n\n```js\nlet config = {\n    include : {\n        classNames : [ \":first-child\", \":last-child\" ]\n    },\n    exclude : {\n        tags : [\n            \"div\", \"table\", \"form\"\n        ]\n    }\n};\n```\n\nAnd here's an unrealistic and irresponsible config showing more options.\n\n```js\nlet config = {\n    include : {\n        classNames : [\n            \"all\", // include the \"all\" group using default class names\n            { \":first-child\" : \"fc\" }, // custom class name\n            { \"form\" : (className) =\u003e className.replace(\":\", \"\") } // remove \":\" from default classname\n        ],\n        tags : [\n            \"div\",\n            \"p\",\n            \"span\"\n        ]\n    },\n    exclude : {\n        classNames : [\n            \"onlyChild\",\n            \":root\",\n            \":read-only\"\n        ],\n        tags : [\n            \"div\"\n        ]\n    }\n}\n```\n\n### Class Name Groups\n\n```js\n{\n    all : [\n        \":default\",\n        \":disabled\",\n        \":empty\",\n        \":enabled\",\n        \":first-child\"\n        \":first-of-type\",\n        \":last-child\",\n        \":last-of-type\",\n        \":only-of-type\",\n        \":only-child\",\n        \":optional\",\n        \":read-only\",\n        \":read-write\",\n        \":required\",\n        \":root\"\n    ],\n    firstLast : [\n        \":first-child\",\n        \":first-child-of-type\",\n        \":last-child\",\n        \":last-child-of-type\"\n    ],\n    firstLastOnly : [\n        \":first-child\",\n        \":last-child\"\n    ],\n    form : [\n        \":default\",\n        \":disabled\",\n        \":enabled\",\n        \":optional\",\n        \":required\",\n        \":read-only\",\n        \":read-write\"\n    ],\n    onlyChild : [\n        \":only-child\",\n        \":only-child-of-type\"\n    ],\n    readWrite : [\n        \":read-only\",\n        \":read-write\"\n    ]\n}\n```\n\n## Pseudo Class Names\n\nList of supported and unsupported pseudo class names. Checkboxes track implementation status.\n\n- ~~`:active`~~\n- ~~`:any`~~\n- ~~`:checked`~~\n- [X] `:default`\n- ~~`:dir()`~~ *\n- [X] `:disabled`\n- [X] `:empty`\n- [X] `:enabled`\n- [X] `:first`\n- [X] `:first-child`\n- [X] `:first-of-type`\n- ~~`:fullscreen`~~\n- ~~`:focus`~~\n- ~~`:hover`~~\n- ~~`:indeterminate`~~\n- ~~`:in-range`~~\n- ~~`:invalid`~~\n- ~~`:lang()`~~ *\n- [X] `:last-child`\n- [X] `:last-of-type`\n- ~~`:left`~~\n- ~~`:link`~~\n- ~~`:not()`~~ *\n- ~~`:nth-child()`~~ *\n- ~~`:nth-last-child()`~~ *\n- ~~`:nth-last-of-type()`~~ *\n- ~~`:nth-of-type()`~~ *\n- [X] `:only-child`\n- [X] `:only-of-type`\n- [X] `:optional`\n- ~~`:out-of-range`~~\n- [X] `:read-only`\n- [X] `:read-write`\n- [X] `:required`\n- ~~`:right`~~\n- [X] `:root`\n- ~~`:scope`~~\n- ~~`:target`~~\n- ~~`:valid`~~\n- ~~`:visited`~~\n\n\\* Hope to add these, but require some thinking due to input parameters.\n\n[build]: https://github.com/kevinkace/posthtml-pseudo/actions/workflows/npm-publish.yml\n[build-badge]: https://github.com/kevinkace/posthtml-pseudo/actions/workflows/npm-publish.yml/badge.svg\n\n[coverage]: https://coveralls.io/github/kevinkace/posthtml-pseudo\n[coverage-badge]: https://coveralls.io/repos/github/kevinkace/posthtml-pseudo/badge.svg\n\n[super-badge]: https://cdn.rawgit.com/kevinkace/posthtml-pseudo/f9adc82/superawesome.svg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevinkace%2Fposthtml-pseudo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkevinkace%2Fposthtml-pseudo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevinkace%2Fposthtml-pseudo/lists"}