l0bsterssg

node.js static responsive blog post generator
Log | Files | Refs | README

http.js (1226B)


      1 /*
      2 Language: HTTP
      3 Description: HTTP request and response headers with automatic body highlighting
      4 Author: Ivan Sagalaev <maniac@softwaremaniacs.org>
      5 Category: common, protocols
      6 Website: https://developer.mozilla.org/en-US/docs/Web/HTTP/Overview
      7 */
      8 
      9 function http(hljs) {
     10   var VERSION = 'HTTP/[0-9\\.]+';
     11   return {
     12     name: 'HTTP',
     13     aliases: ['https'],
     14     illegal: '\\S',
     15     contains: [
     16       {
     17         begin: '^' + VERSION, end: '$',
     18         contains: [{className: 'number', begin: '\\b\\d{3}\\b'}]
     19       },
     20       {
     21         begin: '^[A-Z]+ (.*?) ' + VERSION + '$', returnBegin: true, end: '$',
     22         contains: [
     23           {
     24             className: 'string',
     25             begin: ' ', end: ' ',
     26             excludeBegin: true, excludeEnd: true
     27           },
     28           {
     29             begin: VERSION
     30           },
     31           {
     32             className: 'keyword',
     33             begin: '[A-Z]+'
     34           }
     35         ]
     36       },
     37       {
     38         className: 'attribute',
     39         begin: '^\\w', end: ': ', excludeEnd: true,
     40         illegal: '\\n|\\s|=',
     41         starts: {end: '$', relevance: 0}
     42       },
     43       {
     44         begin: '\\n\\n',
     45         starts: {subLanguage: [], endsWithParent: true}
     46       }
     47     ]
     48   };
     49 }
     50 
     51 module.exports = http;