Skip to content

Commit

Permalink
fix: make syntax highlighting for md js code blocks same as for paylo…
Browse files Browse the repository at this point in the history
…ad samples
  • Loading branch information
RomanHotsiy committed Jan 23, 2019
1 parent 007752d commit d197c0f
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/utils/highlight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit d197c0f

Please sign in to comment.