http.js 1.1 KB

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