Skip to content

Commit 52e8ac7

Browse files
authored
Merge pull request #112 from tjjfvi/patch-2
Fix bug in escapeCode re 5 backticks
2 parents 58c602d + 50b89e3 commit 52e8ac7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/modules/twoslash.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const CODEBLOCK = '```';
1111
// bad. It doesn't properly handle escaping back ticks, so we instead insert zero width spaces
1212
// so that users cannot escape our code block.
1313
function escapeCode(code: string) {
14-
return code.replace(/```/g, '`\u200B`\u200B`');
14+
return code.replace(/`(?=`)/g, '`\u200B');
1515
}
1616

1717
export class TwoslashModule extends Module {

0 commit comments

Comments
 (0)