{"id":15497372,"url":"https://github.com/heapwolf/to-ml","last_synced_at":"2025-04-22T21:43:29.553Z","repository":{"id":9089575,"uuid":"10866052","full_name":"heapwolf/to-ml","owner":"heapwolf","description":"[deprecated] A tiny module to generate markup","archived":false,"fork":false,"pushed_at":"2014-01-25T13:52:14.000Z","size":202,"stargazers_count":14,"open_issues_count":1,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-29T19:11:09.258Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/heapwolf.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":"2013-06-22T14:08:07.000Z","updated_at":"2021-06-14T03:19:58.000Z","dependencies_parsed_at":"2022-08-30T18:52:05.108Z","dependency_job_id":null,"html_url":"https://github.com/heapwolf/to-ml","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heapwolf%2Fto-ml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heapwolf%2Fto-ml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heapwolf%2Fto-ml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heapwolf%2Fto-ml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heapwolf","download_url":"https://codeload.github.com/heapwolf/to-ml/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250330321,"owners_count":21412964,"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-10-02T08:33:13.588Z","updated_at":"2025-04-22T21:43:29.509Z","avatar_url":"https://github.com/heapwolf.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NOTE\n\nIn the real world, I recommend **NEVER** building an app with a tool like this for two main reasons: 1. \n\n  - Generating markup programmatically  **completely** violates the separation of concerns principle. \n  - It's hostile toward project members who do not have Javascript in their skillset.\n\n# SYNOPSIS\nA small library to generate markup.\n\n# DESCRIPTION\nGenerating markup can get ugly, the mix of html and javascript can\nget very confusing very quickly. This little library helps you create \nreadable code. It also has no dependencies on the DOM so you can use \nit on your node.js server.\n\n# USAGE\n```js\nvar template = require('to-ml')().template\n```\n\n```js\ntemplate(function() {\n  return div('hey!',\n    span('this is', \n    b('easy')\n  )\n})\n```\n\n```html\n\u003cdiv\u003ehey!\u003cspan\u003ethis is\u003cb\u003eeasy\u003c/b\u003e\u003c/span\u003e\u003c/div\u003e\n```\n\n### IDs and Classes\nIf a string value matches the pattern used to create `IDs` and `classes`, they\nwill be automatically generated. \n\n```js\na('#home.primary.link', 'home', { href: '/' })\n```\n\n```html\n\u003ca id=\"home\" class=\"primary link\" href=\"/\"\u003ehome\u003c/a\u003e\n```\n\nThe pattern to determine if a string value passed to a tag function is special \nlooks like this...\n\n```\n'[#id][.class1[.class2[...]]]'\n```\n\n### Adding attributes\nJust add an object to the arguments, doesnt mater what order it's provided in.\n```js\ntextarea('hey!', { 'data-id': 'greeting' })\n```\n\n```html\n\u003ctextarea data-id=\"greeting\"\u003ehey!\u003c/textarea\u003e\n```\n\n### When there are no params\n```js\nheader(\n  br,\n  h1('Hello, World!')\n  hr,\n  br\n),\n```\n\n```html\n\u003cheader\u003e\u003cbr\u003e\u003ch1\u003eHello, World!\u003c/h1\u003e\u003chr\u003e\u003cbr\u003e\u003c/header\u003e\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheapwolf%2Fto-ml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheapwolf%2Fto-ml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheapwolf%2Fto-ml/lists"}