Rethinking: How to create HTML? f-string like with conditional-escape

No, that’s not true - in addition to the two methods I provided earlier, I’ve come up with at least two more. (Well, you might consider them variations on a theme rather than unique solutions.) If you’re doing this in a class, you could create a method that gathers local variables and then calls the format method, or you could write a wrapper function that takes the current class and builds the function call.