l0bsterssg

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

diff.js (1116B)


      1 /*
      2 Language: Diff
      3 Description: Unified and context diff
      4 Author: Vasily Polovnyov <vast@whiteants.net>
      5 Website: https://www.gnu.org/software/diffutils/
      6 Category: common
      7 */
      8 
      9 /** @type LanguageFn */
     10 function diff(hljs) {
     11   return {
     12     name: 'Diff',
     13     aliases: ['patch'],
     14     contains: [
     15       {
     16         className: 'meta',
     17         relevance: 10,
     18         variants: [
     19           {begin: /^@@ +\-\d+,\d+ +\+\d+,\d+ +@@$/},
     20           {begin: /^\*\*\* +\d+,\d+ +\*\*\*\*$/},
     21           {begin: /^\-\-\- +\d+,\d+ +\-\-\-\-$/}
     22         ]
     23       },
     24       {
     25         className: 'comment',
     26         variants: [
     27           {begin: /Index: /, end: /$/},
     28           {begin: /={3,}/, end: /$/},
     29           {begin: /^\-{3}/, end: /$/},
     30           {begin: /^\*{3} /, end: /$/},
     31           {begin: /^\+{3}/, end: /$/},
     32           {begin: /^\*{15}$/ }
     33         ]
     34       },
     35       {
     36         className: 'addition',
     37         begin: '^\\+', end: '$'
     38       },
     39       {
     40         className: 'deletion',
     41         begin: '^\\-', end: '$'
     42       },
     43       {
     44         className: 'addition',
     45         begin: '^\\!', end: '$'
     46       }
     47     ]
     48   };
     49 }
     50 
     51 module.exports = diff;