{"id":21317239,"url":"https://github.com/scravy/fastertags","last_synced_at":"2026-02-17T17:01:30.378Z","repository":{"id":257822658,"uuid":"871429592","full_name":"scravy/fastertags","owner":"scravy","description":"An HTML tag library for writing HTML in Python","archived":false,"fork":false,"pushed_at":"2024-12-23T02:23:03.000Z","size":86,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-19T19:45:25.062Z","etag":null,"topics":["html","library","markup","python3"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/fastertags","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scravy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-10-12T00:35:24.000Z","updated_at":"2024-12-23T02:21:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"432d4b7d-55a0-4ae0-8daa-09c9ce3edb26","html_url":"https://github.com/scravy/fastertags","commit_stats":null,"previous_names":["scravy/fastertags"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/scravy/fastertags","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scravy%2Ffastertags","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scravy%2Ffastertags/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scravy%2Ffastertags/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scravy%2Ffastertags/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scravy","download_url":"https://codeload.github.com/scravy/fastertags/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scravy%2Ffastertags/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29423536,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-13T22:20:51.549Z","status":"ssl_error","status_checked_at":"2026-02-13T22:20:49.838Z","response_time":78,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["html","library","markup","python3"],"created_at":"2024-11-21T18:42:34.353Z","updated_at":"2026-02-17T17:01:30.373Z","avatar_url":"https://github.com/scravy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fastertags, an HTML tag library\n\nA typesafe library for writing HTML in Python:\n\n```\nimport fastertags as h\n\nif __name__ == \"__main__\":\n    doc = h.html(\n        h.head(\n            h.title(\"An example document\"),\n        ),\n        h.body(\n            h.h1(\"Title\"),\n            h.p(class_=\"css-class-name\")(\"some paragraph\"),\n            h.p(\"Some more paragraph\"),\n        ),\n    )\n    print(doc)\n```\n\nyields\n\n```\n\u003c!DOCTYPE html\u003e\u003chtml\u003e\u003chead\u003e\u003ctitle\u003eAn example document\u003c/title\u003e\u003c/head\u003e\u003cbody\u003e\u003ch1\u003eTitle\u003c/h1\u003e\u003cp class=\"css-class-name\"\u003esome paragraph\u003c/p\u003e\u003cp\u003eSome more paragraph\u003c/p\u003e\u003c/body\u003e\u003c/html\u003e\n```\n\nTags and Attributes are scraped from the WHATWG HTML Spec\nat [https://html.spec.whatwg.org/](https://html.spec.whatwg.org/).\nVersion numbers reflect when the scraping was done,\nthe current version `0.2024.11` was taken in December 2024.\n\n## HTMX\n\n`fastertags` is a standalone building block for `fasterhtml`, which in turn uses HTMX.  Most notably, `fastertags`\nserializes event-handler `on*` attributes as `hx-on:*`, for example `hx-on:click` instead of `onclick`.\n\nThis can be changed by setting `HTMLElement.EVENT_HANDLER_PREFIX`:\n\n```\ndoc = h.h1().on(\"click\", \"alert('clicked')\")(\"Title\")\n\nprint(doc)\n# \u003ch1 hx-on:click=\"alert('clicked')\"\u003eTitle\u003c/h1\u003e\n\nh.HTMLElement.EVENT_HANDLER_PREFIX= \"on\"\n\nprint(doc)\n# \u003ch1 onclick=\"alert('clicked')\"\u003eTitle\u003c/h1\u003e\n```\n\n## Scoped CSS\n\n`fastertags` emulates the `scoped` attributes on `\u003cstyle\u003e` tags by wrapping its contents in `@scope { ... }`.\nThe `h.style()` function does feature the boolean attribute `scoped` that allows for `True`, `False`, or `None`.\nThe default is `None`, which means contents will be wrapped in `@scope { ... }` if the element is not serialized\nas the child of a `head` element:\n\n```\ndoc = h.html(\n    h.head(\n        h.style(\"not scoped\"),\n    ),\n    h.body(\n        h.style(\"scoped\"),\n    ),\n)\nprint(doc)\n```\n\nyields\n\n```\n\u003c!DOCTYPE html\u003e\u003chtml\u003e\u003chead\u003e\u003cstyle\u003enot scoped\u003c/style\u003e\u003c/head\u003e\u003cbody\u003e\u003cstyle\u003e@scope {scoped}\u003c/style\u003e\u003c/body\u003e\u003c/html\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscravy%2Ffastertags","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscravy%2Ffastertags","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscravy%2Ffastertags/lists"}