MyNixOS website logo
Description

Abstraction for HTML-embedded content.

Please see the README on Github at https://github.com/githubuser/markup#readme

MIT License Hackage Stories in Ready

markup

WARNING: This project is in it's infancy, please don't expect it to work. Thank you :)

A generic interface to chunks of markup.

In this library, we try to ambiguate types of markup via data types, namely Image and JavaScript as examples. From here, we can issue a call to renderMarkup on these abstract labels, which will return some markup wrapped in a monad - in our case, we've made a few monad readers to represent the different ways a single idea can be deployed as markup.

We have three different deployment schemes - inline, hosted, and local. Inline markup simply tries to take the information in question and insert it inside the markup. Hosted markup simply takes the idea and expects it to be somewhere else, possibly hosted in a CDN. Local markup tries to utilize urlpath as the means of representing a local link (absolute, relative, and grounded methods are in another monad - inside the HtmlT m () of lucid, in this case. Urlpath isn't supported for Blaze-html.)

Installation

cabal install markup

Usage

It's a little awkward at the moment:

image' = renderMarkup Image :: Monad m => HostedMarkupT m T.Text (Html ())

image = runHostedMarkupT image' "foo.png"

λ> renderText image

<img src="foo.png">

We could also overload the run* monad transformer actions of each deployment scheme, allowing for the decision to be made just with a type coersion. Maybe in v0.0.2 :)

Here is the same example, going relative instead:

image' = renderMarkup Image :: (Monad m, Url UrlString AbsoluteUrl) => LocalMarkupT UrlString m (HtmlT AbsoluteUrl ())

λ> (runUrlReader $ renderTextT $ runIdentity $ runLocalMarkupT image' $
     "foo.png" <?> ("key","bar")
   ) "example.com"

"<img src=\"example.com/foo.png?key=bar\">"

How to run tests

cabal configure --enable-tests && cabal build && cabal test

Contributing

Fork, PR, repeat.

Metadata

Version

4.2.0

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows