miso-from-html: Convert HTML to miso View syntax

[ bsd3, library, program, web ] [ Propose Tags ] [ Report a vulnerability ]

HTML parser that pretty prints to a Miso View


[Skip to Readme]

Modules

  • Miso
    • From
      • Miso.From.Html

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.2.0.0, 0.3.0.0
Dependencies base (<5), bytestring (<0.13), containers (<0.9), fourmolu (<0.20), html-parse (<0.3), miso (<1.10), miso-from-html, mtl (<2.4), pretty-simple (<4.2), text (<2.2) [details]
License BSD-3-Clause
Copyright (c) David Johnson 2025
Author David Johnson
Maintainer code@dmj.io
Uploaded by DavidJohnson at 2026-04-05T20:53:18Z
Category Web
Bug tracker https://github.com/dmjio/miso-from-html/issues
Source repo head: git clone https://github.com/dmjio/miso-from-html.git
Executables app, miso-from-html
Downloads 846 total (11 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2026-04-05 [all 2 reports]

Readme for miso-from-html-0.3.0.0

[back to package description]

🍜 miso-from-html

Use live from your browser.

Convert HTML into miso View syntax.

Usage

Given some HTML

<nav class="navbar" role="navigation">
  <div class="navbar-brand">
    <a class="navbar-item" href="https://bulma.io">
      <img src="https://bulma.io/images/bulma-logo.png" width="112" height="28" />
      <a>ok<p>hey</p></a>
    </a>
  </div>
</nav>

Convert it to miso View syntax.

$ cabal run miso-from-html < index.html

Result

nav_
    [ class_ "navbar"
    , role_ "navigation"
    ]
    [ div_ [ class_ "navbar-brand" ]
	[ a_
	    [ class_ "navbar-item"
	    , href_ "https://bulma.io"
	    ]
	    [ img_
		[ src_ "https://bulma.io/images/bulma-logo.png"
		, width_ "112"
		, height_ "28"
		]
	    , a_ []
		[ "ok"
		, p_ [][ "hey" ]
		]
	    ]
	]
    ]

Limitations

Currently operates on a single top-level node, not on a list of nodes.

This is invalid since there is no single top-level parent node.

<div>
    foo
</div>
<div>
   bar
</div>

This is valid

<div>
  <div>
      foo
  </div>
  <div>
     bar
  </div>
</div>

Also, if your HTML isn't parsing, make sure it's valid.

When in doubt, check the W3C validation service.

Test

nix develop --command bash -c cabal run < index.html'