diff --git a/public/scripts/extensions/tts/index.js b/public/scripts/extensions/tts/index.js index 74273f2a7..e5a62915a 100644 --- a/public/scripts/extensions/tts/index.js +++ b/public/scripts/extensions/tts/index.js @@ -529,6 +529,10 @@ async function processTtsQueue() { text = text.replace(/```.*?```/gs, '').trim(); } + if (extension_settings.tts.skip_tags) { + text = text.replace(/<.*?>.*?<\/.*?>/g, '').trim(); + } + if (!extension_settings.tts.pass_asterisks) { text = extension_settings.tts.narrate_dialogues_only ? text.replace(/\*[^*]*?(\*|$)/g, '').trim() // remove asterisks content @@ -617,6 +621,7 @@ function loadSettings() { $('#tts_narrate_user').prop('checked', extension_settings.tts.narrate_user); $('#tts_pass_asterisks').prop('checked', extension_settings.tts.pass_asterisks); $('#tts_skip_codeblocks').prop('checked', extension_settings.tts.skip_codeblocks); + $('#tts_skip_tags').prop('checked', extension_settings.tts.skip_tags); $('body').toggleClass('tts', extension_settings.tts.enabled); } @@ -695,6 +700,11 @@ function onSkipCodeblocksClick() { saveSettingsDebounced(); } +function onSkipTagsClick() { + extension_settings.tts.skip_tags = !!$('#tts_skip_tags').prop('checked'); + saveSettingsDebounced(); +} + function onPassAsterisksClick() { extension_settings.tts.pass_asterisks = !!$('#tts_pass_asterisks').prop('checked'); saveSettingsDebounced(); @@ -1018,6 +1028,10 @@ $(document).ready(function () { Skip codeblocks +