{"id":16721275,"url":"https://github.com/khalyomede/el","last_synced_at":"2026-01-02T09:14:21.649Z","repository":{"id":50240177,"uuid":"369655498","full_name":"khalyomede/el","owner":"khalyomede","description":"HTML generation using functions for V.","archived":false,"fork":false,"pushed_at":"2021-11-13T11:26:38.000Z","size":200,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-15T03:47:37.503Z","etag":null,"topics":["generator","html5","vlang","web"],"latest_commit_sha":null,"homepage":"https://vpm.vlang.io/mod/khalyomede.el","language":"V","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/khalyomede.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-05-21T21:13:46.000Z","updated_at":"2021-11-13T11:26:41.000Z","dependencies_parsed_at":"2022-09-06T10:41:37.433Z","dependency_job_id":null,"html_url":"https://github.com/khalyomede/el","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khalyomede%2Fel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khalyomede%2Fel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khalyomede%2Fel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khalyomede%2Fel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/khalyomede","download_url":"https://codeload.github.com/khalyomede/el/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243727404,"owners_count":20337989,"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":["generator","html5","vlang","web"],"created_at":"2024-10-12T22:29:38.653Z","updated_at":"2026-01-02T09:14:21.611Z","avatar_url":"https://github.com/khalyomede.png","language":"V","funding_links":[],"categories":[],"sub_categories":[],"readme":"# html\r\n\r\nHTML generation using functions for V.\r\n\r\n## Summary\r\n\r\n- [About](#about)\r\n- [Features](#features)\r\n- [Installation](#installation)\r\n- [Examples](#examples)\r\n- [Available functions](#available-functions)\r\n- [Known issues](#known-issues)\r\n- [Run tests](#run-tests)\r\n\r\n## About\r\n\r\nI created this library because across all my v web projects, I used to create the same functions to return HTML. I liked the idea behind [Elm UI](https://package.elm-lang.org/packages/mdgriffith/elm-ui/latest/) to generate the view through function calls. I believe this is a handy way to perform complex or business dependent code generation. It also natively leverages the compiler so you get full type checking out of the box.\r\n\r\n## Features\r\n\r\n- Contains functions to generate HTML5 tags string\r\n- Can use a function to generate arbitrary (or non existing) HTML tags\r\n\r\n## Installation\r\n\r\n```bash\r\nv install khalyomede.el\r\n```\r\n\r\n## Examples\r\n\r\n- [1. Generate a simple HTML](#1-generate-a-simple-html)\r\n- [2. Generate abritrary HTML tags](#2-generate-abritrary-html-tags)\r\n- [3. Generate orphan or self closing arbitrary HTML tags](#3-generate-orphan-or-self-closing-arbitrary-html-tags)\r\n\r\n### 1. Generate a simple HTML\r\n\r\nIn this example, we will generate a basic HTML layout to demonstrate how to import and use the HTML functions.\r\n\r\n```v\r\nimport khalyomede.el\r\n\r\nfn main() {\r\n  content := el.page([\r\n    el.html({ \"lang\": \"fr\" }, [\r\n      el.head({}, [\r\n        el.title({}, [\"My website\"])\r\n      ]),\r\n      el.body({}, [\r\n        el.h1({ \"class\": \"text-xl\" }, [\"Home page\"])\r\n      ])\r\n    ])\r\n  ])\r\n}\r\n\r\n```\r\n\r\nWhich will return this string\r\n\r\n```html\r\n\u003c!DOCTYPE html\u003e\r\n\u003chtml\u003e\r\n  \u003chead\u003e\r\n    \u003ctitle\u003eMy website\u003c/title\u003e\r\n  \u003c/head\u003e\r\n  \u003cbody\u003e\r\n    \u003ch1 class=\"text-xl\"\u003eHome page\u003c/h1\u003e\r\n  \u003c/body\u003e\r\n\u003c/html\u003e\r\n```\r\n\r\n### 2. Generate abritrary HTML tags\r\n\r\nIn this example, we will generate HTML from non existing or arbitrary HTML tags.\r\n\r\n```v\r\nimport khalyomede.el\r\n\r\nfn main() {\r\n  content := el.anon(\r\n    name: \"x-navbar\",\r\n    attributes: {\r\n      \"data-initialized\": \"false\",\r\n    },\r\n    children: [\r\n      el.h1({ \"class\": \"text-xl\" }, [\"Brand\"])\r\n    ],\r\n  )\r\n}\r\n```\r\n\r\nWhich will return this HTML string\r\n\r\n```html\r\n\u003cx-navbar\u003e\r\n  \u003ch1 class=\"text-xl\"\u003eBrand\u003c/h1\u003e\r\n\u003c/x-navbar\u003e\r\n```\r\n\r\n### 3. Generate orphan or self closing arbitrary HTML tags\r\n\r\nIn this example, we will generate self closing (or \"orphan\") HTML tags.\r\n\r\n```v\r\nimport khalyomede.el\r\n\r\nfn main() {\r\n  content := el.anon(\r\n    name: \"x-textinput\",\r\n    self_closing: true,\r\n  )\r\n}\r\n```\r\n\r\nWhich will return this HTML string\r\n\r\n```html\r\n\u003cx-textinput /\u003e\r\n```\r\n\r\n## Available functions\r\n\r\nHead to src/el and find the HTML tag you are searching for. You can browse its equivalent test in src/test for an example of usage.\r\n\r\n## Known issues\r\n\r\n- Since `select` is a reserved keyword in V, you will need to use `el.@select({ \"class\": \"form-control\" }, [])` instead (prepending with `@`).\r\n\r\n## Run tests\r\n\r\nTo run test, run this command:\r\n\r\n```bash\r\nv test .\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhalyomede%2Fel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkhalyomede%2Fel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhalyomede%2Fel/lists"}