diff --git a/src/utils/highlight.ts b/src/utils/highlight.ts index 061d05a894..07606d8234 100644 --- a/src/utils/highlight.ts +++ b/src/utils/highlight.ts @@ -21,6 +21,30 @@ import 'prismjs/components/prism-swift.js'; const DEFAULT_LANG = 'clike'; +Prism.languages.insertBefore( + 'javascript', + 'string', + { + 'property string': { + pattern: /([{,]\s*)"(?:\\.|[^\\"\r\n])*"(?=\s*:)/i, + lookbehind: true, + }, + } as any, + undefined as any, +); + +Prism.languages.insertBefore( + 'javascript', + 'punctuation', + { + property: { + pattern: /([{,]\s*)[a-z]\w*(?=\s*:)/i, + lookbehind: true, + }, + }, + undefined as any, +); + /** * map language names to Prism.js names */