Open phact opened 1 month ago
I took a stab at a fix upstream https://github.com/fastai/fastcore/pull/594
This would render the html inline and leave formatting to dev_tools on the browser (which I find does a good job). Can anyone think of any downsides to doing this?
If folks think this is a good approach it would just be a matter of adding inline=True to https://github.com/AnswerDotAI/fasthtml/blob/main/fasthtml/core.py#L269 and https://github.com/AnswerDotAI/fasthtml/blob/main/fasthtml/core.py#L228
I'm happy to create the PR if desired but I'll hold off for now until I get some feedback.
Thanks for the PR, which is now merged. But I wonder if we should also deploy a more "proper" fix which has a list of inline elements, and doesn't reformat those regardless of config?
I fixed this in my library by line-breaking the output HTML only when printing an attribute: https://github.com/yawaramin/dream-html/commit/b51af0723bf5b94c62bb5c1634b423f9b883a145
I fixed this in my library by line-breaking the output HTML only when printing an attribute: yawaramin/dream-html@b51af07
Very nice! I'm a huge fan of dream-html BTW -- definitely a big inspiration for us :D
Ok took another stab at the fastcore improvement, this time with inline_tags https://github.com/fastai/fastcore/pull/605
fix here would be
HTMLResponse(to_xml(resp, inline_tags=['pre']), headers=http_hdrs)
@jph00 could you have a look? Thanks in advance!
Here's a minimum reproducible example:
For correctness it should have rendered:
insted of
We want:
not: