{"id":16818545,"url":"https://github.com/robb/swim","last_synced_at":"2025-04-07T10:27:42.526Z","repository":{"id":38831157,"uuid":"190932086","full_name":"robb/Swim","owner":"robb","description":"A DSL for writing HTML in Swift","archived":false,"fork":false,"pushed_at":"2022-07-12T12:05:12.000Z","size":223,"stargazers_count":309,"open_issues_count":7,"forks_count":9,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-08-06T12:07:59.179Z","etag":null,"topics":["dsl","html","swift","swift-5"],"latest_commit_sha":null,"homepage":"","language":"Swift","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/robb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"robb"}},"created_at":"2019-06-08T20:29:37.000Z","updated_at":"2024-07-21T14:12:28.000Z","dependencies_parsed_at":"2022-09-11T18:12:24.398Z","dependency_job_id":null,"html_url":"https://github.com/robb/Swim","commit_stats":null,"previous_names":["robb/html-dsl"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robb%2FSwim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robb%2FSwim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robb%2FSwim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robb%2FSwim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robb","download_url":"https://codeload.github.com/robb/Swim/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247634687,"owners_count":20970583,"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":["dsl","html","swift","swift-5"],"created_at":"2024-10-13T10:50:25.535Z","updated_at":"2025-04-07T10:27:42.493Z","avatar_url":"https://github.com/robb.png","language":"Swift","funding_links":["https://github.com/sponsors/robb"],"categories":[],"sub_categories":[],"readme":"# Swim – Swift Markup\n\nA DSL for building HTML documents with Swift [function builders].\n\nCurrently in use on [my personal website].\n\n```swift\nimport Swim\nimport HTML\n\nlet myDocument = html(lang: \"en-US\") {\n    head {\n        meta(charset: \"utf-8\", content: \"text/html\", httpEquiv: \"Content-Type\")\n    }\n    body(customAttributes: [ \"data-foo\": \"bar\" ]) {\n        article(classes: \"readme\", \"modern\") {\n            header {\n                h1 {\n                    \"This is a great article.\"\n                }\n            }\n\n            p {\n                \"Hello World!\"\n                br()\n                \"How are you?\"\n            }\n\n            p {\n                \"This is a\"\n                a(href: \"https://swift.org\") { \"link to the Swift website\" }\n                \".\"\n            }\n        }\n    }\n}\n```\n\nBy generating all words in the language according to the HTML specification, we can make sure that only valid HTML can be expressed.\n\nFor example, the above would generate this HTML:\n\n```html\n\u003chtml lang=\"en-US\"\u003e\n  \u003chead\u003e\n    \u003cmeta http-equiv=\"Content-Type\" charset=\"utf-8\" content=\"text/html\" /\u003e\n  \u003c/head\u003e\n  \u003cbody data-foo=\"bar\"\u003e\n    \u003carticle class=\"readme modern\"\u003e\n      \u003cheader\u003e\n        \u003ch1\u003e\n          This is a great article.\n        \u003c/h1\u003e\n      \u003c/header\u003e\n      \u003cp\u003e\n        Hello World!\n        \u003cbr/\u003e\n        How are you?\n      \u003c/p\u003e\n      \u003cp\u003e\n        This is a\n        \u003ca href=\"https://swift.org\"\u003e\n          link to the Swift website\n        \u003c/a\u003e\n        .\n      \u003c/p\u003e\n    \u003c/article\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\n[function builders]: https://github.com/apple/swift-evolution/blob/9992cf3c11c2d5e0ea20bee98657d93902d5b174/proposals/XXXX-function-builders.md\n[my personal website]: http://github.com/robb/robb.swift\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobb%2Fswim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobb%2Fswim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobb%2Fswim/lists"}