icidasset / html-gren

Transmutable HTML for Gren

Home Page:https://packages.gren-lang.org/package/icidasset/html-gren/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A HTML package for Gren.

import Transmutable.Html exposing (Html, html, head, title, body, main_, h1, text)
import Transmutable.Html.Attributes as A (Attribute)

someHtml =
  html
    [ A.lang "en" ]
    [ head
        []
        [ title
            [ text "HTML document" ]
        ]
    , body
        []
        [ main_
            []
            [ h1
                []
                [ text "👋" ]
            ]
        ]
    ]

string =
  Html.toString someHtml

You can also convert this HTML to VirtualDom using this package.

Parsing

import Transmutable.Html as Html

Html.fromString "<html><body><!-- Contents --></body></html>"

Parsers for the individual pieces are available too via the Transmutable.Html.Parser module.

Demo

I've used this for my tokono.ma website, which is a "hybrid" Gren app (both static and dynamic). This package is used there to write static HTML files and render the same HTML templates using Gren's VirtualDom module from the browser package.

Thanks to

This project is based on elm-html-string.

About

Transmutable HTML for Gren

https://packages.gren-lang.org/package/icidasset/html-gren/

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Just 100.0%