]>
luflow.net public git repositories - flow-web.git/blob - static/highlight/languages/http.js
1 /*! `http` grammar compiled for Highlight.js 11.11.1 */
3 var hljsGrammar
= (function () {
8 Description: HTTP request and response headers with automatic body highlighting
9 Author: Ivan Sagalaev <maniac@softwaremaniacs.org>
10 Category: protocols, web
11 Website: https://developer.mozilla.org/en-US/docs/Web/HTTP/Overview
15 const regex
= hljs
.regex
;
16 const VERSION
= 'HTTP/([32]|1\\.[01])';
17 const HEADER_NAME
= /[A-Za-z][A-Za-z0-9-]*/;
19 className: 'attribute',
20 begin: regex
.concat('^', HEADER_NAME
, '(?=\\:\\s)'),
23 className: "punctuation",
33 const HEADERS_AND_BODY
= [
51 begin: '^(?=' + VERSION
+ " \\d{3})",
66 contains: HEADERS_AND_BODY
71 begin: '(?=^[A-Z]+ (.*?) ' + VERSION
+ '$)',
93 contains: HEADERS_AND_BODY
96 // to allow headers to work even without a preamble
97 hljs
.inherit(HEADER
, { relevance: 0 })
106 hljs
.registerLanguage('http', hljsGrammar
);