@takefive Is what you are describing for the traditional notebook interface or JupyterLab? Or both? JupyterLab has better inherent support for code-folding that even survives to reopening later. However, I don’t now about saving it as HTML.
The original poster didn’t provide any detail of what they were using. And no version information about the interface either.