Closed pydanny closed 1 week ago
Interesting suggestion. Do you happen to know which PR it was that reverted the spacing? Curious to know how it was originally implemented.
Also, would you be able to provide any examples of HTML markup where you would find spacing around elements useful that's not working anymore due to the FastHTML update? It might help to figure out alternate solutions.
Also, I just tested the following alternatives. Would any of these be useful?
@rt("/")
def get():
# return Div(A('Link #1'), NotStr(' '), A('Link #2'))
# return Div(A('Link #1'), NotStr(' '), A('Link #2'))
#return Div(A('Link #1', style="margin-right: 1rem;"), A('Link #2'))
return Div(A('Link #1'), ' ', A('Link #2'))
I'm not sure when things changed and tags stopped having breaking HTML between them, I just noted that the headers and footers of my personal site at https://daniel.feldroy.com lost the spaces between them.
Addressed with Nbsp()
Is your feature request related to a problem? Please describe.
FastHTML no longer includes a space between HTML elements. This can cause issues with lists of
A
tags and other elements.Describe the solution you'd like
An concise, easy-to-use method of adding spaces between tags.
Example code
Perhaps simply add this to FastHTML or FastCore:
Should also consider
*args
and**kwargs
, the above approach is arguably simplistic.Another approach would be tor add a
space
ors
attribute to tagsSimilar implementations
I used the
S()
function approach in the releases app. You can see the definition of the tag and one of the implementations here.Problem solved
Makes it easier to format text.
Confirmation Please confirm the following: