/ src / theme / languages / shell.js
shell.js
 1  /*! `shell` grammar compiled for Highlight.js 11.10.0 */
 2    (function(){
 3      var hljsGrammar = (function () {
 4    'use strict';
 5  
 6    /*
 7    Language: Shell Session
 8    Requires: bash.js
 9    Author: TSUYUSATO Kitsune <make.just.on@gmail.com>
10    Category: common
11    Audit: 2020
12    */
13  
14    /** @type LanguageFn */
15    function shell(hljs) {
16      return {
17        name: 'Shell Session',
18        aliases: [
19          'console',
20          'shellsession'
21        ],
22        contains: [
23          {
24            className: 'meta.prompt',
25            // We cannot add \s (spaces) in the regular expression otherwise it will be too broad and produce unexpected result.
26            // For instance, in the following example, it would match "echo /path/to/home >" as a prompt:
27            // echo /path/to/home > t.exe
28            begin: /^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,
29            starts: {
30              end: /[^\\](?=\s*$)/,
31              subLanguage: 'bash'
32            }
33          }
34        ]
35      };
36    }
37  
38    return shell;
39  
40  })();
41  
42      hljs.registerLanguage('shell', hljsGrammar);
43    })();