fasthtml icon indicating copy to clipboard operation
fasthtml copied to clipboard

[BUG] html2ft handling empty attribute

Open renatodamas opened this issue 9 months ago • 0 comments

Describe the bug html2ft converts boolean attributes to empty string (attribute_name='') instead of conveting it to attribute_name=True.

Minimal Reproducible Example Enter <div hidden> <p> Text ... </p> </div> at https://h2f.answer.ai/

Expected behavior You should get:

Div(
    P('Text ...'),
    hidden=True
)

but instead you get:

Div(
    P('Text ...'),
    hidden=''
)

When it renders, it is leading to the html code: <div> <p> Text ... </p> </div>, which differ from the original one.

Environment Information

  • fastlite version: 1.8.1
  • fastcore version: 0.1.3
  • fasthtml version: 0.12.14

Confirmation Please confirm the following:

  • [ x ] I have read the FAQ (https://docs.fastht.ml/explains/faq.html)
  • [ x ] I have provided a minimal reproducible example
  • [ x ] I have included the versions of fastlite, fastcore, and fasthtml
  • [ x ] I understand that this is a volunteer open source project with no commercial support.

renatodamas avatar May 13 '25 01:05 renatodamas