diff --git a/src/formatters/ssml/microsoft_azure.rs b/src/formatters/ssml/microsoft_azure.rs index 0d60f16..219e88a 100644 --- a/src/formatters/ssml/microsoft_azure.rs +++ b/src/formatters/ssml/microsoft_azure.rs @@ -215,6 +215,15 @@ impl MicrosoftAzureSsmlFormatter { match node.node_type { NodeType::PlainText => Ok(node.text.clone()), NodeType::TextModifier => self.format_azure_text_modifier(node), + // Azure's Speech service does not support the W3C SSML + // element: an utterance containing one synthesises zero audio, + // with no error from the service. Its documented equivalent is + // (fired as a Bookmark event instead of a + // named position). + NodeType::Mark => Ok(format!( + "", + self.base.escape_xml(&node.text) + )), _ => self.base.format_node_internal(node), } } @@ -447,6 +456,23 @@ mod tests { assert!(result.is_ok()); } + #[test] + fn test_microsoft_azure_mark_emits_bookmark() { + // Azure has no W3C (it silently synthesises zero audio); + // the documented equivalent is . + let input = "A [mark: \"b1\"] in the text."; + let result = + SpeechMarkdownParser::to_ssml(input, crate::formatters::base::Platform::MicrosoftAzure); + assert!(result.is_ok()); + + let ssml = result.unwrap(); + assert!(ssml.contains(""), "got: {ssml}"); + assert!( + !ssml.contains("