csp.js 834 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. Language: CSP
  3. Description: Content Security Policy definition highlighting
  4. Author: Taras <oxdef@oxdef.info>
  5. Website: https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
  6. vim: ts=2 sw=2 st=2
  7. */
  8. /** @type LanguageFn */
  9. function csp(hljs) {
  10. return {
  11. name: 'CSP',
  12. case_insensitive: false,
  13. keywords: {
  14. $pattern: '[a-zA-Z][a-zA-Z0-9_-]*',
  15. keyword: 'base-uri child-src connect-src default-src font-src form-action ' +
  16. 'frame-ancestors frame-src img-src media-src object-src plugin-types ' +
  17. 'report-uri sandbox script-src style-src'
  18. },
  19. contains: [
  20. {
  21. className: 'string',
  22. begin: "'",
  23. end: "'"
  24. },
  25. {
  26. className: 'attribute',
  27. begin: '^Content',
  28. end: ':',
  29. excludeEnd: true
  30. }
  31. ]
  32. };
  33. }
  34. module.exports = csp;