source: node_modules/refractor/lang/tsx.js

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: 966 bytes
Line 
1'use strict'
2var refractorJsx = require('./jsx.js')
3var refractorTypescript = require('./typescript.js')
4module.exports = tsx
5tsx.displayName = 'tsx'
6tsx.aliases = []
7function 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.