{"id":15056327,"url":"https://github.com/bel-framework/bel-html","last_synced_at":"2026-02-16T08:33:13.377Z","repository":{"id":233898638,"uuid":"786962930","full_name":"bel-framework/bel-html","owner":"bel-framework","description":"HTML utilities for Erlang","archived":false,"fork":false,"pushed_at":"2024-04-17T14:21:27.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-21T04:55:19.808Z","etag":null,"topics":["erlang","erlang-library","html","html-parser","html5","parser"],"latest_commit_sha":null,"homepage":"","language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bel-framework.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","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},"funding":{"github":["williamthome"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":["https://www.buymeacoffee.com/williamthome"]}},"created_at":"2024-04-15T16:21:31.000Z","updated_at":"2024-04-17T14:23:46.000Z","dependencies_parsed_at":"2024-04-17T16:37:56.382Z","dependency_job_id":null,"html_url":"https://github.com/bel-framework/bel-html","commit_stats":null,"previous_names":["bel-framework/bel-html"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bel-framework/bel-html","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bel-framework%2Fbel-html","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bel-framework%2Fbel-html/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bel-framework%2Fbel-html/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bel-framework%2Fbel-html/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bel-framework","download_url":"https://codeload.github.com/bel-framework/bel-html/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bel-framework%2Fbel-html/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29503809,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-16T08:14:25.707Z","status":"ssl_error","status_checked_at":"2026-02-16T08:14:25.334Z","response_time":115,"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":["erlang","erlang-library","html","html-parser","html5","parser"],"created_at":"2024-09-24T21:49:56.926Z","updated_at":"2026-02-16T08:33:13.354Z","avatar_url":"https://github.com/bel-framework.png","language":"Erlang","funding_links":["https://github.com/sponsors/williamthome","https://www.buymeacoffee.com/williamthome"],"categories":[],"sub_categories":[],"readme":"# bel-framework/bel-html\n\nHTML utilities for Erlang.\n\n## Scanner and Parser\n\n### Example\n\n```erlang\n1\u003e String = \u003c\u003c\"\n   \u003c!DOCTYPE html\u003e\n   \u003chtml lang=\\\"en\\\"\u003e\n   \u003c!-- Comment --\u003e\n   \u003chead\u003e\n       \u003ctitle\u003e\u003cb\u003econtent inside \u003ctitle\u003e must be treated as plaintext\u003c/b\u003e\u003c/title\u003e\n       \u003cscript src=\\\"assets/foo.js\\\"\u003e\u003c/script\u003e\n       \u003cstyle\u003e\n           :root {\n               --foo: 0;\n           }\n       \u003c/style\u003e\n   \u003c/head\u003e\n   \u003cbody\u003e\n       \u003ch1\u003eForm\u003c/h1\u003e\n       \u003cbr\u003e\n       \u003cbr/\u003e\n       \u003cform\u003e\n           \u003cdiv\u003eFoo Form\u003c/div\u003e\n           \u003cinput id=\\\"foo\\\" class=' foo   bar   ' name='foo' value='\\\"b\\ar\\\"' /\u003e\n           \u003cinput type=\\\"number\\\" value=10 /\u003e\n       \u003c/form\u003e\n   \u003c/body\u003e\n   \u003c/html\u003e\n   \"\u003e\u003e.\n\n2\u003e Tokens = bel_html:scan_html5(String).\n[{open,{{2,4},undefined,undefined},\n       {\u003c\u003c\"!DOCTYPE\"\u003e\u003e,[{\u003c\u003c\"html\"\u003e\u003e,{true,{2,4}}}]}},\n {open,{{3,4},undefined,undefined},\n       {\u003c\u003c\"html\"\u003e\u003e,[{\u003c\u003c\"lang\"\u003e\u003e,{\u003c\u003c\"en\"\u003e\u003e,{3,4}}}]}},\n {comment,{{4,4},undefined,undefined},\u003c\u003c\" Comment \"\u003e\u003e},\n {open,{{5,4},undefined,undefined},{\u003c\u003c\"head\"\u003e\u003e,[]}},\n {open,{{6,8},undefined,undefined},{\u003c\u003c\"title\"\u003e\u003e,[]}},\n {text,{{6,15},undefined,undefined},\n       \u003c\u003c\"\u003cb\u003econtent inside \u003ctitle\u003e must be treated as plaintext\u003c/b\u003e\"\u003e\u003e},\n {close,{{6,73},undefined,undefined},\u003c\u003c\"title\"\u003e\u003e},\n {open,{{7,8},undefined,undefined},\n       {\u003c\u003c\"script\"\u003e\u003e,[{\u003c\u003c\"src\"\u003e\u003e,{\u003c\u003c\"assets/foo.js\"\u003e\u003e,{7,8}}}]}},\n {close,{{7,36},undefined,undefined},\u003c\u003c\"script\"\u003e\u003e},\n {open,{{8,8},undefined,undefined},{\u003c\u003c\"style\"\u003e\u003e,[]}},\n {text,{{8,15},undefined,undefined},\n       \u003c\u003c\":root {\\n               --foo: 0;\\n           }\"\u003e\u003e},\n {close,{{12,8},undefined,undefined},\u003c\u003c\"style\"\u003e\u003e},\n {close,{{13,4},undefined,undefined},\u003c\u003c\"head\"\u003e\u003e},\n {open,{{14,4},undefined,undefined},{\u003c\u003c\"body\"\u003e\u003e,[]}},\n {open,{{15,8},undefined,undefined},{\u003c\u003c\"h1\"\u003e\u003e,[]}},\n {text,{{15,12},undefined,undefined},\u003c\u003c\"Form\"\u003e\u003e},\n {close,{{15,16},undefined,undefined},\u003c\u003c\"h1\"\u003e\u003e},\n {void,{{16,8},undefined,undefined},{\u003c\u003c\"br\"\u003e\u003e,[]}},\n {void,{{17,8},undefined,undefined},{\u003c\u003c\"br\"\u003e\u003e,[]}},\n {open,{{18,8},undefined,undefined},{\u003c\u003c\"form\"\u003e\u003e,[]}},\n {open,{{19,12},undefined,undefined},{\u003c\u003c\"div\"\u003e\u003e,[]}},\n {text,{{19,17},undefined,undefined},\u003c\u003c\"Foo Form\"\u003e\u003e},\n {close,{{19,25},undefined,undefined},\u003c\u003c\"div\"\u003e\u003e},\n {void,{{20,12},undefined,undefined},\n       {\u003c\u003c\"input\"\u003e\u003e,\n        [{\u003c\u003c\"id\"\u003e\u003e,{\u003c\u003c\"foo\"\u003e\u003e,{20,12}}},\n         {\u003c\u003c\"class\"\u003e\u003e,{[\u003c\u003c\"foo\"\u003e\u003e,\u003c\u003c\"bar\"\u003e\u003e],{20,21}}},\n         {\u003c\u003c\"name\"\u003e\u003e,{\u003c\u003c\"foo\"\u003e\u003e,{20,43}}},\n         {\u003c\u003c\"value\"\u003e\u003e,{\u003c\u003c\"\\\"bar\\\"\"\u003e\u003e,{20,54}}}]}},\n {void,{{21,12},undefined,undefined},\n       {\u003c\u003c\"input\"\u003e\u003e,\n        [{\u003c\u003c\"type\"\u003e\u003e,{\u003c\u003c\"number\"\u003e\u003e,{21,12}}},\n         {\u003c\u003c\"value\"\u003e\u003e,{\u003c\u003c\"10\"\u003e\u003e,{21,26}}}]}},\n {close,{{22,8},undefined,undefined},\u003c\u003c\"form\"\u003e\u003e},\n {close,{{23,4},undefined,undefined},\u003c\u003c\"body\"\u003e\u003e},\n {close,{{24,4},undefined,undefined},\u003c\u003c\"html\"\u003e\u003e}]\n\n3\u003e bel_html:parse_html5(Tokens).\n[{\u003c\u003c\"!DOCTYPE\"\u003e\u003e,\n  #{\u003c\u003c\"html\"\u003e\u003e =\u003e true},\n  [{\u003c\u003c\"html\"\u003e\u003e,\n    #{\u003c\u003c\"lang\"\u003e\u003e =\u003e \u003c\u003c\"en\"\u003e\u003e},\n    [{\u003c\u003c\"head\"\u003e\u003e,#{},\n      [{\u003c\u003c\"title\"\u003e\u003e,#{},\n        [\u003c\u003c\"\u003cb\u003econtent inside \u003ctitle\u003e must be treated as plaintext\u003c/b\u003e\"\u003e\u003e]},\n       {\u003c\u003c\"script\"\u003e\u003e,#{\u003c\u003c\"src\"\u003e\u003e =\u003e \u003c\u003c\"assets/foo.js\"\u003e\u003e},[]},\n       {\u003c\u003c\"style\"\u003e\u003e,#{},\n        [\u003c\u003c\":root {\\n               --foo: 0;\\n           }\"\u003e\u003e]}]},\n     {\u003c\u003c\"body\"\u003e\u003e,#{},\n      [{\u003c\u003c\"h1\"\u003e\u003e,#{},[\u003c\u003c\"Form\"\u003e\u003e]},\n       {\u003c\u003c\"br\"\u003e\u003e,#{},[]},\n       {\u003c\u003c\"br\"\u003e\u003e,#{},[]},\n       {\u003c\u003c\"form\"\u003e\u003e,#{},\n        [{\u003c\u003c\"div\"\u003e\u003e,#{},[\u003c\u003c\"Foo Form\"\u003e\u003e]},\n         {\u003c\u003c\"input\"\u003e\u003e,\n          #{\u003c\u003c\"class\"\u003e\u003e =\u003e [\u003c\u003c\"foo\"\u003e\u003e,\u003c\u003c\"bar\"\u003e\u003e],\n            \u003c\u003c\"id\"\u003e\u003e =\u003e \u003c\u003c\"foo\"\u003e\u003e,\u003c\u003c\"name\"\u003e\u003e =\u003e \u003c\u003c\"foo\"\u003e\u003e,\n            \u003c\u003c\"value\"\u003e\u003e =\u003e \u003c\u003c\"\\\"bar\\\"\"\u003e\u003e},\n          []},\n         {\u003c\u003c\"input\"\u003e\u003e,\n          #{\u003c\u003c\"type\"\u003e\u003e =\u003e \u003c\u003c\"number\"\u003e\u003e,\u003c\u003c\"value\"\u003e\u003e =\u003e \u003c\u003c\"10\"\u003e\u003e},\n          []}]}]}]}]}]\n```\n\n\u003e [!NOTE]\n\u003e The structure of the parsed tokens is `{Tag, Attributes, Nodes}`.\n\n## Build\n\n```shell\n$ rebar3 compile\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbel-framework%2Fbel-html","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbel-framework%2Fbel-html","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbel-framework%2Fbel-html/lists"}