{"id":16965050,"url":"https://github.com/propensive/honeycomb","last_synced_at":"2025-09-03T02:43:37.046Z","repository":{"id":39483402,"uuid":"132527826","full_name":"propensive/honeycomb","owner":"propensive","description":"A lightweight and typesafe DSL for embedding HTML in Scala code","archived":false,"fork":false,"pushed_at":"2025-02-04T20:04:22.000Z","size":2343,"stargazers_count":7,"open_issues_count":4,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-18T11:52:02.707Z","etag":null,"topics":["dsl","html","html5","scala","typesafe"],"latest_commit_sha":null,"homepage":"https://propensive.com/honeycomb/","language":"Scala","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/propensive.png","metadata":{"files":{"readme":".github/readme.md","changelog":null,"contributing":".github/contributing.md","funding":null,"license":null,"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":"2018-05-07T23:35:51.000Z","updated_at":"2025-02-04T20:04:26.000Z","dependencies_parsed_at":"2023-11-16T09:25:55.906Z","dependency_job_id":"6f03ab91-0a33-45cc-a6ec-7ec11d0bf88a","html_url":"https://github.com/propensive/honeycomb","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/propensive%2Fhoneycomb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/propensive%2Fhoneycomb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/propensive%2Fhoneycomb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/propensive%2Fhoneycomb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/propensive","download_url":"https://codeload.github.com/propensive/honeycomb/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244971848,"owners_count":20540870,"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","html5","scala","typesafe"],"created_at":"2024-10-13T23:44:54.801Z","updated_at":"2025-03-22T14:31:06.026Z","avatar_url":"https://github.com/propensive.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"[\u003cimg alt=\"GitHub Workflow\" src=\"https://img.shields.io/github/actions/workflow/status/propensive/honeycomb/main.yml?style=for-the-badge\" height=\"24\"\u003e](https://github.com/propensive/honeycomb/actions)\n[\u003cimg src=\"https://img.shields.io/discord/633198088311537684?color=8899f7\u0026label=DISCORD\u0026style=for-the-badge\" height=\"24\"\u003e](https://discord.com/invite/MBUrkTgMnA)\n\u003cimg src=\"/doc/images/github.png\" valign=\"middle\"\u003e\n\n# Honeycomb\n\n__Perfectly-nested HTML__\n\n_Honeycomb_ provides a typesafe representation of HTML5 which goes as far as possible in the scope of\nScala's type system to ensure that the HTML specification is correctly modeled, for example by\nenforcing nesting rules between different tags.\n\n## Features\n\n- simple method-application style for constructing HTML nodes\n- nodes and sequences of nodes may be embedded and mixed inside HTML nodes\n- the type of a node defines the valid types of its child nodes, enforcing the HTML5 specification through the type system\n- values of other types may be embedded in HTML, if an appropriate typeclass instance exists\n- a simple named-parameter style is provided for HTML attributes\n- HTML attributes are strongly-typed, and the types accepted by each are defined by typeclasses\n\n\n## Availability\n\n\n\n\n\n\n\n## Getting Started\n\n### Constructing HTML nodes\n\nSimple HTML nodes can be constructed by applying other nodes (or strings) to `Tag` instances, for example:\n```scala\nval table = Table(\n  Tbody(\n    Tr(Th(\"Name\"), Th(\"Age\")),\n    Tr(Td(\"Andrew\"), Td(\"18\"))\n  )\n)\n```\n\nNote that the two `Tr` nodes are separated by a comma (`,`) since they are applied as repeated arguments.\n\nThis will produce HTML nodes representing the HTML code:\n```html\n\u003ctable\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003cth\u003eName\u003c/th\u003e\n      \u003cth\u003eAge\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth\u003eAndrew\u003c/th\u003e\n      \u003cth\u003e18\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n```\n\nThe example shows,\n- a `Tbody` node nested inside a `Table`\n- `Tr` nodes nested inside a `Tbody`\n- `Th` and `Td` nodes nested inside `Tr`s\n\nThese are all permitted in HTML 5, so they are permitted in Honeycomb. But while it would be\npossible to write the HTML,\n```html\n\u003ctr\u003e\n  \u003ctbody\u003e\n    \u003ctd\u003eName\u003c/td\u003e\n  \u003c/tbody\u003e\n\u003c/tr\u003e\n```\nand a web browser may even render it in some way, the code `Tr(Tbody(Td(\"Name\")))` is not valid,\nand will not compile, because a `Td` cannot be a direct child of a `Tbody` node, and a `Tbody` node\nmay not be nested inide a `Tr` node.\n\n`Tag` objects for every HTML node exist, and rules about which nodes are permitted as children of\neach one are encoded in their types. This makes it possible to write HTML code which conforms to the\nHTML 5 specification.\n\n`Tag`s have the same name as their HTML counterparts, written with a capital letter.\n\nThere are some limitations to this in cases where HTML's rules are defined in terms of more than a\nsimple nesting relationship, but work is ongoing to encode as many constraints as possible. In all\ncases where HTML 5 rules are not fully implemented, Honeycomb is more permissive.\n\n### Attributes\n\nHTML nodes may also have attributes. These can be applied to an additional parameter block _before_\nthe child nodes, in the style of named parameters, for example,\n```scala\nTd(colspan = 2, id = \"cell_1\")(\"Data\")\n```\n\nOnly attributes that are valid for a particular `Tag` type may be used on that tag. Also note that the\nattribute values have different types: `colspan` takes an `Int` and `id` takes a `String`. By default,\nattributes are configured to accept the most suitable types for describing their values, without\nbeing overly permissive.\n\nMany such types are not defined in Honeycomb, since their representation is best handled by other\nlibraries. Other libraries may nevertheless make their types usable by Honeycomb without adding a\nhard dependency on Honeycomb. This facility is provided through typeclasses defined in\n[Anticipation](https://github.com/propensive/anticipation), which becomes a necessary dependency\nof both libraries, but is tiny, so does not impose any significant burden.\n\nFor example, if including [Gesticulate](https://github.com/propensive/gesticulate/) to represent\nMedia types, it becomes possible use a Gesticulate media type for an attribute such as `type` on\na `Style` tag, like so,\n```scala\nimport gesticulate.*\nval styles = Style(htype = media\"text/css\")(css)\n```\nwithout any additional imports.\n\nA contextual instance of `anticipation.HtmlAttribute` is all that is required to make this possible.\n\n\n\n\n\n## Status\n\nHoneycomb is classified as __fledgling__. For reference, Soundness projects are\ncategorized into one of the following five stability levels:\n\n- _embryonic_: for experimental or demonstrative purposes only, without any guarantees of longevity\n- _fledgling_: of proven utility, seeking contributions, but liable to significant redesigns\n- _maturescent_: major design decisions broady settled, seeking probatory adoption and refinement\n- _dependable_: production-ready, subject to controlled ongoing maintenance and enhancement; tagged as version `1.0.0` or later\n- _adamantine_: proven, reliable and production-ready, with no further breaking changes ever anticipated\n\nProjects at any stability level, even _embryonic_ projects, can still be used,\nas long as caution is taken to avoid a mismatch between the project's stability\nlevel and the required stability and maintainability of your own project.\n\nHoneycomb is designed to be _small_. Its entire source code currently consists\nof 987 lines of code.\n\n## Building\n\nHoneycomb will ultimately be built by Fury, when it is published. In the\nmeantime, two possibilities are offered, however they are acknowledged to be\nfragile, inadequately tested, and unsuitable for anything more than\nexperimentation. They are provided only for the necessity of providing _some_\nanswer to the question, \"how can I try Honeycomb?\".\n\n1. *Copy the sources into your own project*\n   \n   Read the `fury` file in the repository root to understand Honeycomb's build\n   structure, dependencies and source location; the file format should be short\n   and quite intuitive. Copy the sources into a source directory in your own\n   project, then repeat (recursively) for each of the dependencies.\n\n   The sources are compiled against the latest nightly release of Scala 3.\n   There should be no problem to compile the project together with all of its\n   dependencies in a single compilation.\n\n2. *Build with [Wrath](https://github.com/propensive/wrath/)*\n\n   Wrath is a bootstrapping script for building Honeycomb and other projects in\n   the absence of a fully-featured build tool. It is designed to read the `fury`\n   file in the project directory, and produce a collection of JAR files which can\n   be added to a classpath, by compiling the project and all of its dependencies,\n   including the Scala compiler itself.\n   \n   Download the latest version of\n   [`wrath`](https://github.com/propensive/wrath/releases/latest), make it\n   executable, and add it to your path, for example by copying it to\n   `/usr/local/bin/`.\n\n   Clone this repository inside an empty directory, so that the build can\n   safely make clones of repositories it depends on as _peers_ of `honeycomb`.\n   Run `wrath -F` in the repository root. This will download and compile the\n   latest version of Scala, as well as all of Honeycomb's dependencies.\n\n   If the build was successful, the compiled JAR files can be found in the\n   `.wrath/dist` directory.\n\n## Contributing\n\nContributors to Honeycomb are welcome and encouraged. New contributors may like\nto look for issues marked\n[beginner](https://github.com/propensive/honeycomb/labels/beginner).\n\nWe suggest that all contributors read the [Contributing\nGuide](/contributing.md) to make the process of contributing to Honeycomb\neasier.\n\nPlease __do not__ contact project maintainers privately with questions unless\nthere is a good reason to keep them private. While it can be tempting to\nrepsond to such questions, private answers cannot be shared with a wider\naudience, and it can result in duplication of effort.\n\n## Author\n\nHoneycomb was designed and developed by Jon Pretty, and commercial support and\ntraining on all aspects of Scala 3 is available from [Propensive\nO\u0026Uuml;](https://propensive.com/).\n\n\n\n## Name\n\nHoneycomb is named after the hexagonal prismic cells in a bees' nest, where they store their honey and their larvæ; the most innovative feature of Honeycomb is its provision of safe nesting of HTML nodes.\n\nIn general, Soundness project names are always chosen with some rationale,\nhowever it is usually frivolous. Each name is chosen for more for its\n_uniqueness_ and _intrigue_ than its concision or catchiness, and there is no\nbias towards names with positive or \"nice\" meanings—since many of the libraries\nperform some quite unpleasant tasks.\n\nNames should be English words, though many are obscure or archaic, and it\nshould be noted how willingly English adopts foreign words. Names are generally\nof Greek or Latin origin, and have often arrived in English via a romance\nlanguage.\n\n## Logo\n\nThe logo shows part of the abdomen of a bee, the insect which makes honeycomb.\n\n## License\n\nHoneycomb is copyright \u0026copy; 2025 Jon Pretty \u0026 Propensive O\u0026Uuml;, and\nis made available under the [Apache 2.0 License](/license.md).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpropensive%2Fhoneycomb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpropensive%2Fhoneycomb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpropensive%2Fhoneycomb/lists"}