I had the same issue. Indeed table elements are very strict and can only accept a set of element.
The solution I decided to go with and that I suggest is to stop using tables and use div instead, you can then use CSS to style it just like a table with display: table
, display: table-row
, display: table-cell
etc.
If you use a utility CSS framework like tailwind it’s very simple.