Skip to content

Commit d197c0f

Browse files
committed
fix: make syntax highlighting for md js code blocks same as for payload samples
1 parent 007752d commit d197c0f

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/utils/highlight.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,30 @@ import 'prismjs/components/prism-swift.js';
2121

2222
const DEFAULT_LANG = 'clike';
2323

24+
Prism.languages.insertBefore(
25+
'javascript',
26+
'string',
27+
{
28+
'property string': {
29+
pattern: /([{,]\s*)"(?:\\.|[^\\"\r\n])*"(?=\s*:)/i,
30+
lookbehind: true,
31+
},
32+
} as any,
33+
undefined as any,
34+
);
35+
36+
Prism.languages.insertBefore(
37+
'javascript',
38+
'punctuation',
39+
{
40+
property: {
41+
pattern: /([{,]\s*)[a-z]\w*(?=\s*:)/i,
42+
lookbehind: true,
43+
},
44+
},
45+
undefined as any,
46+
);
47+
2448
/**
2549
* map language names to Prism.js names
2650
*/

0 commit comments

Comments
 (0)