strip_markdown
Strip Markdown formatting symbols before TTS synthesis.
- async pipecat.utils.text.transforms.strip_markdown.strip_markdown(text: str, aggregation_type: str | AggregationType) str[source]
Remove Markdown formatting symbols that have no spoken equivalent.
Strips bold/italic markers, backtick code spans, fenced code blocks, ATX headers, and blockquote markers. Does not modify link or image syntax since those may carry meaningful text (the link label is preserved verbatim).
This transformer is alphanumeric-preserving: the normalized alnum sequence of the output is identical to the input, so the
WordCompletionTrackerrequires no segment-map overhead.- Parameters:
text – Input text, potentially containing Markdown formatting.
aggregation_type – Aggregation type of the text frame (unused).
- Returns:
Text with Markdown formatting symbols removed.
Example:
result = await strip_markdown("**Hello** and _world_", "*") # "Hello and world"