prism-jsx.js 710 B

12345678910111213141516171819202122
  1. (function(Prism) {
  2. var javascript = Prism.util.clone(Prism.languages.javascript);
  3. Prism.languages.jsx = Prism.languages.extend('markup', javascript);
  4. Prism.languages.jsx.tag.pattern= /<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|[^\s'">=]+|(\{[\w\W]*?\})))?\s*)*\/?>/i;
  5. Prism.languages.jsx.tag.inside['attr-value'].pattern = /=[^\{](?:('|")[\w\W]*?(\1)|[^\s>]+)/i;
  6. Prism.languages.insertBefore('inside', 'attr-value',{
  7. 'script': {
  8. pattern: /=(\{[\w\W]*?\})/i,
  9. inside: {
  10. 'function' : Prism.languages.javascript.function,
  11. 'punctuation': /[={}[\];(),.:]/,
  12. 'keyword': Prism.languages.javascript.keyword
  13. },
  14. 'alias': 'language-javascript'
  15. }
  16. }, Prism.languages.jsx.tag);
  17. }(Prism));