markup: Abstraction for HTML-embedded content

[ bsd3, data, library, web ] [ Propose Tags ]

Please see the README on Github at

[Skip to Readme]
Versions 0.0.1, 0.0.2, 0.0.3, 0.0.4, 0.0.5, 0.0.6,, 0.0.7, 0.0.8, 1.0.0, 1.1.0, 2.0.0, 2.1.0, 2.1.1, 2.2.0, 3.0.0, 3.1.0, 4.0.0, 4.0.1, 4.0.2, 4.0.3, 4.0.4, 4.1.0, 4.2.0 (info)
Dependencies attoparsec-uri (>=0.0.4), base (>=4.8 && <5), blaze-html, blaze-markup, clay, comonad, lucid (>=2.5), mmorph, monad-control, monad-logger, mtl, path, path-extra (>=0.2.0), resourcet, text, transformers-base, urlpath (>=9.0.0) [details]
License BSD-3-Clause
Copyright Copyright (c) 2018 Athan Clark
Author Athan Clark
Category Data, Web
Home page
Bug tracker
Source repo head: git clone
Uploaded by athanclark at Wed Apr 11 15:39:39 UTC 2018
Distributions NixOS:4.2.0
Downloads 5876 total (305 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2018-04-13 [all 1 reports]
Hackage Matrix CI




Maintainer's Corner

For package maintainers and hackage trustees

Readme for markup-4.2.0

[back to package description]

MIT License Hackage Stories in Ready


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.)


cabal install markup


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")
   ) ""

"<img src=\"\">"

How to run tests

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


Fork, PR, repeat.