I have a large block of repeating code in my html file. I have no need to wrap it with an html tag, but I'd like to be able to hide it by folding it.

I know I can select the whole thing and use the keyboard command for "fold", but I have to do that every time. I'd like to know if there some sort of special comment syntax to define a foldable region.

You can use the RegReplace plugin to find and fold/unfold your code blocks. You can use literal string searches or regex.

Your other alternative is to write a plugin that that allows you to mark regions (maybe with a faint outline). And then you can have a command that folds/unfolds all marked regions. If you change the code in those regions (make the region bigger or smaller), you would have to re-mark it though.

Basically you can fold any region if you are able to give the region end points. The problem is you have to be able to determine what those end points are, which is why I suggest RegReplace, which can find the regions by rules you set.

write a plugin that allows you to mark regions (maybe with a faint outline)

How would this be done please? Presumably we replace the text with the same text of a certain scope..?

There is a fold and unfold API command. You just feed it a list of regions. RegReplace uses regular expression to find regions, and feeds them to the one of these API commands. To do a manual plugin, you would just have a command that adds the current selection region to the view as a region with a key name of your choice, and you simply specify if you want as an outline, hidden, etc.

Then when you want to fold or unfold, you request the list of regions from the view and fold or fold them.