-
-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
live webview of pretty-simple in action #50
Comments
I'm adding the |
From the footnotes of this blog post, the library is called shower. Here is their interactive webpage: https://monadfix.com/shower/. |
It is written using GHCJS and Reflex: https://github.com/monadfix/shower/tree/master/js |
With #73, the HTML generation becomes pretty trivial: pPrintHtml :: Show a => a -> Html ()
pPrintHtml = renderHtml . fmap renderStyle . treeForm . layoutString defaultOutputOptionsLightBg . show
where
renderStyle (Style mc b i) =
(if b then b_ else id) . case mc of
Nothing -> id
Just c -> span_ [style_ $ renderColor c]
renderColor c = "color:" <> T.pack (show c) (I'm not quite sure what to do with the intensity value)
This would be quite a cool thing to have in place for the 4.0 release. |
Ugly proof of concept using Miso: https://georgefst.github.io/ The full colour highlighting actually works properly in a local version (with |
@georgefst Wow, that's really neat! |
Made a branch for this in case you're interested. Obviously very much WIP. |
@cdepillabout You'll notice I've gone a bit quiet. And it could be a while yet before I come back to this. So I'm thinking, we:
Are you happy if I go ahead with the release? |
@georgefst Thanks for all your work. Please feel free to go ahead with the release. Eventually I'd like to move the webview URL to something like https://cdepillabout.github.io/pretty-simple/, so that I also have control over updating it, but I am fine with it being at https://georgefst.github.io/pretty-simple/ for now. When you do the release, can you make sure to do the following two things:
|
Closing in favour of #81 |
It would be nice to have a website that could be used interactively to show how pretty-simple formats things.
This could be done in the following steps:
pretty-simple
with GHCJS.show
ed Haskell datatype. It should have another Haskell datatype on the right that shows the input Haskell datatype formatted with pretty-simple.I think there is another pretty-printing library for Haskell that does something like the above, but I forget what the library is called. It might be a good idea to look at how they are doing it.
The text was updated successfully, but these errors were encountered: