/ src / theme / languages / python-repl.js
python-repl.js
 1  /*! `python-repl` grammar compiled for Highlight.js 11.10.0 */
 2    (function(){
 3      var hljsGrammar = (function () {
 4    'use strict';
 5  
 6    /*
 7    Language: Python REPL
 8    Requires: python.js
 9    Author: Josh Goebel <hello@joshgoebel.com>
10    Category: common
11    */
12  
13    function pythonRepl(hljs) {
14      return {
15        aliases: [ 'pycon' ],
16        contains: [
17          {
18            className: 'meta.prompt',
19            starts: {
20              // a space separates the REPL prefix from the actual code
21              // this is purely for cleaner HTML output
22              end: / |$/,
23              starts: {
24                end: '$',
25                subLanguage: 'python'
26              }
27            },
28            variants: [
29              { begin: /^>>>(?=[ ]|$)/ },
30              { begin: /^\.\.\.(?=[ ]|$)/ }
31            ]
32          }
33        ]
34      };
35    }
36  
37    return pythonRepl;
38  
39  })();
40  
41      hljs.registerLanguage('python-repl', hljsGrammar);
42    })();