Skip to content

Commit 50b89e3

Browse files
authored
Fix bug in escapeCode re 5 backticks
````` was replaced with `ZWS`ZWS```, which still escaped the code block. This will replace it with `ZWS`ZWS`ZWS`ZWS`
1 parent 5db2a93 commit 50b89e3

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)