Repository navigation
Wish: support for rendering with newlines #161
Replies: 3 comments
|
I think this is possible by outputting a Seq of tagged events in the internal StateT. And then one can decide how to layout those events. There might be a performance hit compared with directly outputting to a Builder. I’d have to benchmark it and see if it’s a big hit or a little hit. It might not be much different, don’t know until you bench it. lucid doesn’t bill itself as a high performance library, but e.g. a 2x slow down would probably be considered a regression. blaze-markup’s pretty printer goes via String, so if you’re using that you might not be concerned about performance. Apparently it doesn’t work correctly, so you might need to fix it first: haskell-servant/servant-blaze#2 jaspervdj/blaze-html#111 jaspervdj/blaze-html#103 It doesn’t look very easy to do it properly. I know the blaze authors added it for debugging, but such is the way of things that it gets held to a standard of complete correctness. 😂 |
|
Maybe you could provide a reformatting function in a module like .Debug that did the naive thing on a ByteString, which would let you write a trivial pretty printer without people having the wrong expectations? |
|
Hmm, does https://github.com/georgefst/prettyprinter-lucid help as a workaround? I haven't tried it yet but it seems like it can do pretty-printing of Lucid's Correction: looks like the link I posted is for pretty-printing other things (generic data structures) using HTML output using Lucid. It's not for pretty-printing the HTML itself. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
As inspecting diffs or troubleshooting with one huge line of output is hard.
Pretty indented output like blaze-html's would be a bonus.
Related: hledgerorg/hledger#2321
All reactions