{"_id":"h","_rev":"2794288","name":"h","description":"generate HTML from javascript array structures","dist-tags":{"latest":"1.0.0"},"maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"time":{"modified":"2022-07-08T02:37:33.000Z","created":"2012-08-20T16:33:13.637Z","1.0.0":"2019-07-19T18:43:47.841Z","0.1.0":"2012-08-22T15:50:10.260Z","0.0.0":"2012-08-20T16:33:13.637Z"},"users":{},"author":{"name":"'Dominic Tarr' @EMovhfIrFk4NihAKnRNhrfRaqIhBv1Wj8pTxJNgvCCY=.ed25519"},"repository":{"type":"git","url":"git://github.com/dominictarr/h.git"},"versions":{"1.0.0":{"name":"h","version":"1.0.0","homepage":"https://github.com/dominictarr/h","repository":{"type":"git","url":"git://github.com/dominictarr/h.git"},"dependencies":{"cssesc":"^3.0.0","html-escape":"^2.0.0"},"devDependencies":{"hyperscript":"^2.0.2","tape":"^4.11.0"},"scripts":{"test":"tape test/*.js"},"author":{"name":"'Dominic Tarr' @EMovhfIrFk4NihAKnRNhrfRaqIhBv1Wj8pTxJNgvCCY=.ed25519"},"license":"MIT","gitHead":"9bd25f461244ee600bf8f94018dfd6115378a044","description":"generate HTML from javascript array structures","bugs":{"url":"https://github.com/dominictarr/h/issues"},"_id":"h@1.0.0","_nodeVersion":"8.15.0","_npmVersion":"6.9.0","dist":{"shasum":"a637773a89b3c07d316bdbda87d4a65b2a5f8cf4","size":3657,"noattachment":false,"key":"/h/-/h-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/h/download/h-1.0.0.tgz"},"maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"_npmUser":{"name":"dominictarr","email":"dominic.tarr@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/h_1.0.0_1563561827736_0.05959383746678726"},"_hasShrinkwrap":false,"publish_time":1563561827841,"_cnpm_publish_time":1563561827841,"_cnpmcore_publish_time":"2021-12-17T04:17:56.976Z"},"0.1.0":{"name":"h","version":"0.1.0","homepage":"https://github.com/dominictarr/h","repository":{"type":"git","url":"git://github.com/dominictarr/h.git"},"dependencies":{},"devDependencies":{"tap":"0.3.0"},"scripts":{"test":"tap test"},"author":{"name":"'Dominic Tarr'","email":"dominic.tarr@gmail.com","url":"http://dominictarr.com"},"license":"MIT","_id":"h@0.1.0","description":"generate HTML from javascript the easy way.","dist":{"shasum":"24211fe1d9cef2b36cae8ff8255606ea12ecdfb5","size":2754,"noattachment":false,"key":"/h/-/h-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/h/download/h-0.1.0.tgz"},"maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"directories":{},"publish_time":1345650610260,"_hasShrinkwrap":false,"_cnpm_publish_time":1345650610260,"_cnpmcore_publish_time":"2021-12-17T04:17:57.188Z"},"0.0.0":{"name":"h","version":"0.0.0","homepage":"https://github.com/dominictarr/h","repository":{"type":"git","url":"git://github.com/dominictarr/h.git"},"dependencies":{},"devDependencies":{"tap":"0.3.0"},"scripts":{"test":"tap test"},"author":{"name":"'Dominic Tarr'","email":"dominic.tarr@gmail.com","url":"http://dominictarr.com"},"license":"MIT","_id":"h@0.0.0","description":"## License","dist":{"shasum":"c4675e9481ff5b82a802bb240529e701707abb48","size":2062,"noattachment":false,"key":"/h/-/h-0.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/h/download/h-0.0.0.tgz"},"maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"directories":{},"publish_time":1345480393637,"_hasShrinkwrap":false,"_cnpm_publish_time":1345480393637,"_cnpmcore_publish_time":"2021-12-17T04:17:57.408Z"}},"readme":"# h\n\ngenerate HTML from javascript array structures\n\nlike hyperscript but with arrays instead of functions.\nruns easily on the server and web workers, without a HtmlElement polyfil.\n\n## Example\n\n``` js\n\nvar toHTML = require('h')\n\ntoHTML(\n  ['div#page',\n    ['div#header',\n      ['h1.classy', 'h')),\n    ['div#menu', { style: 'float: left, width: 200px' } },\n      ['ul',\n        ['li', 'one'],\n        ['li', 'two'],\n        ['li', 'three']]],\n    ['div#content', {style: 'float: left;' },\n      ['h2', 'content title'],\n      ['p', \n        \"so it's just like a templating engine,\\n\",\n        \"but easy to use inline with javascript\\n\"],\n      ['p', \n        \"the intension is for this to be used to create\\n\",\n        \"reusable, interactive html widgets. \"]]]\n)\n\n```\n\n## toHTML (ary)\n\nCreate some html from an array structure.\nIf the first element in the array is a string, that's the tag name.\nif it is an array of arrays, each item is mapped through `toHTML`\nand the results are concatenated.\n\n### classes & id\n\nIf the tag name is of form `name.class1.class2#id` that is a short cut\nfor setting the class and id.\n\n### attributes\n\nIf an `{}` object is passed in, it's values will be used to set attributes.\n\n``` js\nh('a', {href: 'https://npm.im/h'}, 'h')\n```\n\nhtml attributes names must be alphanumeric but may have hypens.\nattribute values will be escaped with `html-escape`.\n\n### innerHTML: non-escaped html content.\n\nsometimes it is necessary to output non-escaped html,\nfor example, rendered markdown, or the output of another templating library.\nto do this, use the `{innerHTML:html}` attribute. Note, this will cause any\nfollowing children to be ignored.\n\n### children - string\n\nIf an argument is a string, it will be escaped with `html-escape`\n\n### children - null.\n\nThis is just ignored.\n\n### children - Array\n\nEach item in the array is treated like a ordinary child. (string or HTMLElement)\nthis is uesful when you want to iterate over an object:\n\n```\n['table',\n  Object.keys(obj).map(function (k) {\n    return ['tr'\n      ['th', k],\n      ['td', obj[k]]\n    ]\n  }]\n\n```\n\n## License\n\nMIT\n","_attachments":{},"homepage":"https://github.com/dominictarr/h","bugs":{"url":"https://github.com/dominictarr/h/issues"},"license":"MIT"}