25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

16 lines
668 B

  1. (function (Prism) {
  2. var typescript = Prism.util.clone(Prism.languages.typescript);
  3. Prism.languages.tsx = Prism.languages.extend('jsx', typescript);
  4. // doesn't work with TS because TS is too complex
  5. delete Prism.languages.tsx['parameter'];
  6. delete Prism.languages.tsx['literal-property'];
  7. // This will prevent collisions between TSX tags and TS generic types.
  8. // Idea by https://github.com/karlhorky
  9. // Discussion: https://github.com/PrismJS/prism/issues/2594#issuecomment-710666928
  10. var tag = Prism.languages.tsx.tag;
  11. tag.pattern = RegExp(/(^|[^\w$]|(?=<\/))/.source + '(?:' + tag.pattern.source + ')', tag.pattern.flags);
  12. tag.lookbehind = true;
  13. }(Prism));