only include encodeHTML if it is needed and selfcontained is set to true