]> luflow.net public git repositories - flow-web.git/blob - static/highlight/languages/csp.js
Initial commit.
[flow-web.git] / static / highlight / languages / csp.js
1 /*! `csp` grammar compiled for Highlight.js 11.11.1 */
2 (function(){
3 var hljsGrammar = (function () {
4 'use strict';
5
6 /*
7 Language: CSP
8 Description: Content Security Policy definition highlighting
9 Author: Taras <oxdef@oxdef.info>
10 Website: https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
11 Category: web
12
13 vim: ts=2 sw=2 st=2
14 */
15
16 /** @type LanguageFn */
17 function csp(hljs) {
18 const KEYWORDS = [
19 "base-uri",
20 "child-src",
21 "connect-src",
22 "default-src",
23 "font-src",
24 "form-action",
25 "frame-ancestors",
26 "frame-src",
27 "img-src",
28 "manifest-src",
29 "media-src",
30 "object-src",
31 "plugin-types",
32 "report-uri",
33 "sandbox",
34 "script-src",
35 "style-src",
36 "trusted-types",
37 "unsafe-hashes",
38 "worker-src"
39 ];
40 return {
41 name: 'CSP',
42 case_insensitive: false,
43 keywords: {
44 $pattern: '[a-zA-Z][a-zA-Z0-9_-]*',
45 keyword: KEYWORDS
46 },
47 contains: [
48 {
49 className: 'string',
50 begin: "'",
51 end: "'"
52 },
53 {
54 className: 'attribute',
55 begin: '^Content',
56 end: ':',
57 excludeEnd: true
58 }
59 ]
60 };
61 }
62
63 return csp;
64
65 })();
66
67 hljs.registerLanguage('csp', hljsGrammar);
68 })();