DioxusLabs/docsite

Mention HTML --> RSX/Component translation (`dx translate`) in docs

creambyemute opened this issue · 1 comments

Hey there,

I'm atm exploring dioxus and found out that there is a cli command dx translate to convert HTML --> RSXand the command dx translate -c to convert HTML --> Dioxus component and thought that is pretty cool.

It might be worth mentioning this in the docs as a short circuit for translating html components to dioxus as it saves quite a bit of manual typing when converting html components.

Maybe add a small example like:

https://daisyui.com/components/bottom-navigation/ or https://daisyui.com/components/card/

Save the content html content as (or input it as raw according to dx translate)

  • Card.html, example with an img src
  • BottomNav.html example with svgs

dx translate -f Card.html -o Card.rs for rsx
dx translate -c -f Card.html -o Card.rs for a dioxus component

I would also add a warning that the generated output should be verified afterwards. In the example above the Card HTML h2 Tag is being converted to h_2 which is not quite correct but for other stuff it works great!

I would also add a warning that the generated output should be verified afterwards. In the example above the Card HTML h2 Tag is being converted to h_2 which is not quite correct but for other stuff it works great!

DioxusLabs/dioxus#1782 fixes that and a few other bugs!