{"id":18426392,"url":"https://github.com/complate/complate-stream","last_synced_at":"2025-04-07T16:32:37.496Z","repository":{"id":45563163,"uuid":"92649880","full_name":"complate/complate-stream","owner":"complate","description":"complate's core library for rendering HTML via JSX","archived":false,"fork":false,"pushed_at":"2021-12-08T13:47:51.000Z","size":124,"stargazers_count":6,"open_issues_count":10,"forks_count":7,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-01T21:04:16.889Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://complate.org","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/complate.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-28T08:46:11.000Z","updated_at":"2021-12-08T13:47:52.000Z","dependencies_parsed_at":"2022-08-27T00:31:03.257Z","dependency_job_id":null,"html_url":"https://github.com/complate/complate-stream","commit_stats":null,"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/complate%2Fcomplate-stream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/complate%2Fcomplate-stream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/complate%2Fcomplate-stream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/complate%2Fcomplate-stream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/complate","download_url":"https://codeload.github.com/complate/complate-stream/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247688182,"owners_count":20979617,"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":"2024-11-06T05:07:49.916Z","updated_at":"2025-04-07T16:32:37.228Z","avatar_url":"https://github.com/complate.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"complate-stream\n===============\n\n[complate](https://complate.org)'s core library for rendering HTML\n\n[![package version](https://img.shields.io/npm/v/complate-stream.svg?style=flat)](https://www.npmjs.com/package/complate-stream)\n[![build status](https://travis-ci.org/complate/complate-stream.svg?branch=master)](https://travis-ci.org/complate/complate-stream)\n[![Greenkeeper badge](https://badges.greenkeeper.io/complate/complate-stream.svg)](https://greenkeeper.io)\n\n\nHow It Works\n------------\n\nAt the core of complate-stream lies `generateHTML`, an implementation of the\nsignature expected by [JSX](https://facebook.github.io/jsx/) (as\n[pioneered by React](https://reactjs.org/docs/jsx-in-depth.html)). When invoked,\nthat function returns an \"element generator\"; a function serving as placeholder\nfor the HTML element to be generated:\n\n```javascript\ngenerateHTML(\"html\", { lang: \"en\" },\n        generateHTML(\"body\", { id: \"top\" },\n                generateHTML(\"h1\", null, \"hello world\"),\n                generateHTML(\"p\", null, \"lorem ipsum\")));\n```\n\nThis indirection is necessary primarily to ensure proper order and nesting, as\nfunction arguments are evaluated before the surrounding invocation – otherwise\nthe code above would emit `\u003ch1\u003e` and `\u003cp\u003e` before the `\u003cbody\u003e` and `\u003chtml\u003e`\nelements.\n\nThus the example above returns a hierarchy of element generators, encapsulated\nby a single element generator at the root, which upon invocation writes HTML to\nthe `stream` object being passed in:\n\n```javascript\nlet element = generateHTML(…);\nelement(stream, …);\n```\n\n(`stream` is expected to support the methods `#write`, `#writeln` and `#flush`;\nsee `BufferedStream` for a sample implementation).\n\nWith our example, this should result in the following string being emitted:\n\n```html\n\u003chtml lang=\"en\"\u003e\u003cbody id=\"top\"\u003e\u003ch1\u003ehello world\u003c/h1\u003e\u003cp\u003elorem ipsum\u003c/p\u003e\u003c/body\u003e\u003c/html\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomplate%2Fcomplate-stream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcomplate%2Fcomplate-stream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomplate%2Fcomplate-stream/lists"}