Would be willing to bet this is the issue. Adding html files to context for gemini models results in a ton of token use.
EDIT: why must users care?
Maybe the questioner is also in full control of the HTML creation and they don’t need a parser for all possible HTML edge cases.
It seems that even the very conceptually simple example given by the questioner is impossible.
EDIT: why must users care?