You could use interaction.formatOutput to do this.