{"id":21242734,"url":"https://github.com/koaning/mohtml","last_synced_at":"2025-09-05T13:31:46.087Z","repository":{"id":263051657,"uuid":"889192760","full_name":"koaning/mohtml","owner":"koaning","description":"DSL for HTML that targets marimo and more!","archived":false,"fork":false,"pushed_at":"2025-07-03T08:50:16.000Z","size":7578,"stargazers_count":51,"open_issues_count":2,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-01T18:02:05.290Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://koaning.github.io/mohtml/","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/koaning.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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}},"created_at":"2024-11-15T19:43:46.000Z","updated_at":"2025-08-28T15:56:20.000Z","dependencies_parsed_at":"2024-11-15T20:46:28.263Z","dependency_job_id":"f4d5aa0d-7034-468a-9d60-f61d5bba8be9","html_url":"https://github.com/koaning/mohtml","commit_stats":null,"previous_names":["koaning/mohtml"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/koaning/mohtml","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koaning%2Fmohtml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koaning%2Fmohtml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koaning%2Fmohtml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koaning%2Fmohtml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/koaning","download_url":"https://codeload.github.com/koaning/mohtml/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koaning%2Fmohtml/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273765671,"owners_count":25164179,"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","status":"online","status_checked_at":"2025-09-05T02:00:09.113Z","response_time":402,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-11-21T01:01:06.969Z","updated_at":"2025-09-05T13:31:41.061Z","avatar_url":"https://github.com/koaning.png","language":"Python","readme":"\u003cimg src=\"imgs/icon.png\" width=\"125\" height=\"125\" align=\"right\" /\u003e\n\n### `mohtml`\n\nThis project is all about a DSL to write HTML in Python. \n\n\u003e This work is *heavily* inspired by [FastHTML](https://fastht.ml/).\n\u003e \n\u003e I mainly made this to see if I could reimplement it easily and if I might be able to hack together a lightweight variant of the idea for [Marimo](https://marimo.app/). If you feel like giving folks credit, feel free to join the [FastHTML Discord](https://discord.gg/qcXvcxMhdP) and give them a high-five first. \n\n## Installation\n\nYou can install this project via uv/pip: \n\n```python\nuv pip install mohtml\n```\n\n## Quick demo\n\nWith that out of the way, let's have a quick look what what the DSL is like.\n\n```python\n# You can import any HTML element this way\nfrom mohtml import a, p, div, script, h1\n\ndiv(\n    script(src=\"https://cdn.tailwindcss.com\"),\n    h1(\"welcome to my blog\", klass=\"font-bold text-xl\"),\n    p(\"my name is vincent\", klass=\"text-gray-500 text-sm\"),\n    a(\"please check my site\", href=\"https://calmcode.io\", klass=\"underline\")\n)\n```\n\nThis code will generate the following HTML:\n\n```html\n\u003cdiv\u003e\n \u003cscript src=\"https://cdn.tailwindcss.com\"\u003e\n \u003c/script\u003e\n \u003ch1 class=\"font-bold text-xl\"\u003e\n  welcome to my blog\n \u003c/h1\u003e\n \u003cp class=\"text-gray-500 text-sm\"\u003e\n  my name is vincent\n \u003c/p\u003e\n \u003ca class=\"underline\" href=\"https://calmcode.io\"\u003e\n  please check my site\n \u003c/a\u003e\n\u003c/div\u003e\n```\n\nYou can also render this HTML nicely from Marimo via: \n\n```python\nmyhtml = div(...)\nmo.Html(f\"{myhtml}\")\n```\n\n## From here?\n\nThis is already pretty cool on it's own, but there are a few directions here. \n\n1. Maybe we can use this tool to make representations of objects nicer in Marimo.\n2. Maybe we can come up with a nice way to turn these HTML objects into something reactive.\n3. Maybe we can use this as an alternative for Jinja templates in some dases. Could be nice to make some simple dashboard-y UI components here.\n","funding_links":[],"categories":["Libraries"],"sub_categories":["Deployment Templates"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoaning%2Fmohtml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkoaning%2Fmohtml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoaning%2Fmohtml/lists"}