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