fix(transcription): strip ***bold italic*** markdown emphasis - #6549
Open
darrenori wants to merge 2 commits into
Open
fix(transcription): strip ***bold italic*** markdown emphasis#6549darrenori wants to merge 2 commits into
***bold italic*** markdown emphasis#6549darrenori wants to merge 2 commits into
Conversation
The markdown filter handled `*text*` and `**text**` but not the combined `***text***` / `___text___` form, so those delimiters leaked through to TTS and were read aloud. Neither existing pattern can match it: the bold pattern's body is `[^*\n]+?`, which stops at the third asterisk, and the italic pattern has a `(?!\s|\*)` guard right after the opening delimiter. The same applies to the underscore variants. Add a triple-delimiter pattern ahead of each existing pair. The word/asterisk boundary assertions are unchanged, so arithmetic (`x**2`), globs (`*.py`) and dunder names are still preserved.
Exercise `***text***` and `___text___` across several chunk sizes, so the streaming path is checked as well as the single-shot one.
|
|
longcw
approved these changes
Jul 27, 2026
longcw
left a comment
Contributor
There was a problem hiding this comment.
thanks for the pr! could you sign the CLA before we merge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
filter_markdownstrips markdown before text reaches TTS, but it only covers*italic*and**bold**. The combined***text***/___text___form is left untouched, so the delimiters leak through and get spoken.Neither existing pattern can match it:
[^*\n]+?, which stops at the third asterisk(?!\s|\*)guard rejects a*immediately after the opening delimiterSame for the underscore variants. LLMs emit
***…***fairly often for emphasis, so this shows up in practice.Fix
Add a triple-delimiter pattern ahead of each existing pair. The word/asterisk boundary assertions (
(?<![\w*])/(?![\w*])) are carried over unchanged from the existing patterns.Tests
Added
test_bold_italic, covering the four cases above across chunk sizes1, 2, 3, 7, 50so the streaming path is exercised too. All fail before the change, pass after.Existing coverage is unaffected — the full
MARKDOWN_INPUTdocument test, the punctuation-boundary cases, and the no-false-positive cases (2 * 3 = 6,Use *.py files,x**2 + y**2 = z**2,__dunder_method__) all still pass.ruff checkandruff formatare clean.