main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
668 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | (function (Prism) {
|
---|
| 2 | var typescript = Prism.util.clone(Prism.languages.typescript);
|
---|
| 3 | Prism.languages.tsx = Prism.languages.extend('jsx', typescript);
|
---|
| 4 |
|
---|
| 5 | // doesn't work with TS because TS is too complex
|
---|
| 6 | delete Prism.languages.tsx['parameter'];
|
---|
| 7 | delete Prism.languages.tsx['literal-property'];
|
---|
| 8 |
|
---|
| 9 | // This will prevent collisions between TSX tags and TS generic types.
|
---|
| 10 | // Idea by https://github.com/karlhorky
|
---|
| 11 | // Discussion: https://github.com/PrismJS/prism/issues/2594#issuecomment-710666928
|
---|
| 12 | var tag = Prism.languages.tsx.tag;
|
---|
| 13 | tag.pattern = RegExp(/(^|[^\w$]|(?=<\/))/.source + '(?:' + tag.pattern.source + ')', tag.pattern.flags);
|
---|
| 14 | tag.lookbehind = true;
|
---|
| 15 | }(Prism));
|
---|
Note:
See
TracBrowser
for help on using the repository browser.