package html_of_jsx

Build not checked
  1. Overview
  2. Docs
Render HTML writing JSX

Install

dune-project
 Dependency

Authors

Maintainers

Sources

html_of_jsx-0.0.1.tbz
sha256=d1a36abcbebd23adfaffe9eed27e69045c1e112da17bfebc385355d2a64f1fb7
sha512=bee674151f2ab6fba41acc1234118b5eca5379aedab2907da517bdeb604ddd02807519b9b29b4eea09595ced9936300b9a6ebf16c9edd92d959151daab4e7a96

Description

Added to opam-repository:

README

html_of_jsx

html_of_jsx is an implementation of JSX designed to render HTML on the server, without React or anything else. It's a minimal library that allows you to write components of HTML in a declarative way.

  • Supports most of features from JSX (uppercase components, fragments, optional attributes, punning)
  • but with a few improvements (lowercase components, no need to add annotations)
  • No React idioms (no className, no htmlFor, no onChange, etc...)
  • Type-safe, validates attributes and their types (it can be better thought)
  • Minimal

    • Html_of_jsx.render to render an element to HTML
    • Jsx.* to construct DOM Elements and DOM nodes (Jsx.text, Jsx.int, Jsx.null, Jsx.list)
  • Works with Reason and mlx

Installation

opam pin add html_of_jsx git+https://github.com/davesnx/html_of_jsx
+ (library html_of_jsx.lib)
+ (preprocess (pps html_of_jsx.ppx))

Usage

let element = <a href="https://x.com/davesnx">
  <span> {"Click me!"} </span>
</a>

let html: string = Html_of_jsx.render(element);

Check the demo/server.re file to see a full example with a tiny HTTP server.

Documentation

Check the Documentation to know more about the API and the features.

Credits

This library is extracted from server-reason-react and simplified to just work with HTML5.

Dependencies (4)

  1. ppxlib > "0.23.0" & <= "0.31.0"
  2. reason >= "3.10.0"
  3. ocaml >= "5.0.0"
  4. dune >= "3.8"

Dev Dependencies (5)

  1. tiny_httpd with-test
  2. ocaml-lsp-server with-test
  3. ocamlformat = "0.26.1" & with-test
  4. odoc with-doc
  5. alcotest with-test

Optional Dependencies

None

Used by (1)

  1. dream >= "1.0.0~alpha7"

Conflicts

None

Build status

Results of building html_of_jsx with each compiler on check.ci.ocaml.org, run of against opam-repository 6e2873f. All results for this package.

Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.

This version is not in the latest run; the versions below are.

Version OCaml 4.11 OCaml 4.14 OCaml 5.2 OCaml 5.4 OCaml 5.5
0.1.2 n/a good good good good
  • good Package successfully built
  • partial One of the dependencies failed to build
  • bad Package failed to build
  • n/a Package is not available in this environment
  • internal Internal failure