Rendering optional content based on output format

I want to specify a section in a book chapter as optional.
I only want to render it when publishing to HTML as the section contains text and code chunks related to animations.
How may I do this?
I've asked this quesiton over at stackoverflow too.
I will close both questions as soon as I get an answer, and will post said answer on both sites

This was answered over on stackoverflow


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.