{"id":16042551,"url":"https://github.com/nylen/phs","last_synced_at":"2025-10-18T20:26:26.562Z","repository":{"id":57323292,"uuid":"92455101","full_name":"nylen/phs","owner":"nylen","description":"Parameterized HTML Schemas - A toolset to validate and deserialize/serialize structured HTML.","archived":false,"fork":false,"pushed_at":"2017-05-27T21:53:07.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-05T15:50:22.563Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nylen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-26T00:09:40.000Z","updated_at":"2020-02-23T03:02:58.000Z","dependencies_parsed_at":"2022-09-12T05:50:49.986Z","dependency_job_id":null,"html_url":"https://github.com/nylen/phs","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/nylen/phs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nylen%2Fphs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nylen%2Fphs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nylen%2Fphs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nylen%2Fphs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nylen","download_url":"https://codeload.github.com/nylen/phs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nylen%2Fphs/sbom","scorecard":{"id":699889,"data":{"date":"2025-08-18","repo":{"name":"github.com/nylen/phs","commit":"a7503d5623c94d9d9ccd3c55fb5f061de270fa66"},"scorecard":{"version":"v5.2.1-41-g40576783","commit":"40576783fda6698350fcbbeaea760ff827433034"},"score":2.6,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/16 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#pinned-dependencies"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#packaging"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#sast"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-22T04:57:17.070Z","repository_id":57323292,"created_at":"2025-08-22T04:57:17.070Z","updated_at":"2025-08-22T04:57:17.070Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272847012,"owners_count":25003114,"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-30T02:00:09.474Z","response_time":77,"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":"2024-10-09T00:02:49.024Z","updated_at":"2025-10-18T20:26:26.449Z","avatar_url":"https://github.com/nylen.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## `phs` (Parameterized HTML Schemas) [![Build status](https://img.shields.io/travis/nylen/phs/master.svg?style=flat)](https://travis-ci.org/nylen/phs) [![npm package](http://img.shields.io/npm/v/phs.svg?style=flat)](https://www.npmjs.org/package/phs)\n\nThis is a library that can be used to describe and validate chunks of HTML.  It\nis inspired by\n[RELAX NG](http://relaxng.org/),\nbut with a few very different goals.  `phs` schemas are designed to:\n\n- Accept placeholders for parameters, so that schemas can also be used to\n  serialize and deserialize chunks of data to/from HTML.\n  _Not implemented yet._\n- Be more concise and easier to author/read/understand than the full RELAX NG\n  specification.\n- Resemble the HTML they describe and be easily expressible in JSX notation.\n\n**Note:** Currently this library contains the *bare minimum to be at all useful*.\n\n## How to use\n\nCurrently it's recommended to use JSX with the\n[`transform-jsx-flexible` Babel plugin](https://github.com/nylen/babel-plugin-transform-jsx-flexible).\nIf you're using React, for example, this allows you to continue using React\nelements along with `phs` schemas within the same file.\n\nConfigure the plugin as follows in your `.babelrc`:\n\n```js\n\"plugins\": [\n    ...\n    [ \"./lib/babel-plugin-transform-jsx-flexible\", {\n        tags: {\n            Schema: 'createSchemaElement',\n        }\n    } ],\n    ...\n]\n```\n\nIn your JSX code files:\n\n```js\nimport { createSchemaElement, Schema, Element } from 'phs';\n\nconst schema = (\n    \u003cSchema\u003e\n        \u003cElement name=\"p\" /\u003e\n    \u003c/Schema\u003e\n);\n\nconst fragment = /* DOM fragment or similar object returned by a parser */;\n\nconst result = schema.validateFragment( fragment );\n\nconsole.log( result ); // either `true` or an `Error`\n```\n\nThere are also a couple of validation functions other than `validateFragment`:\n\n- `validateNodes( arrayOfNodes )`\n- `validateNode( singleNode )`\n\n## Schema elements\n\n### `\u003cElement name=\"tagName\"\u003e`\n\nMatches a single HTML element with the tag name `tagName`.  `tagName` can also\nbe a string like `'p|span'` to provide a choice between multiple tag names.\n\nThere is also a shorthand for `\u003cElement\u003e` that is designed to more closely\nresemble the HTML it describes.  These two constructions are equivalent:\n\n```js\nconst schema1 = (\n    \u003cSchema\u003e\n        \u003cElement name=\"div\" /\u003e;\n    \u003c/Schema\u003e\n);\n\nconst schema2 = (\n    \u003cSchema\u003e\n        \u003cdiv /\u003e\n    \u003c/Schema\u003e\n);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnylen%2Fphs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnylen%2Fphs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnylen%2Fphs/lists"}