]> luflow.net public git repositories - flow-web.git/blob - static/highlight/es/languages/julia-repl.js
Initial commit.
[flow-web.git] / static / highlight / es / languages / julia-repl.js
1 /*! `julia-repl` grammar compiled for Highlight.js 11.11.1 */
2 var hljsGrammar = (function () {
3 'use strict';
4
5 /*
6 Language: Julia REPL
7 Description: Julia REPL sessions
8 Author: Morten Piibeleht <morten.piibeleht@gmail.com>
9 Website: https://julialang.org
10 Requires: julia.js
11 Category: scientific
12
13 The Julia REPL code blocks look something like the following:
14
15 julia> function foo(x)
16 x + 1
17 end
18 foo (generic function with 1 method)
19
20 They start on a new line with "julia>". Usually there should also be a space after this, but
21 we also allow the code to start right after the > character. The code may run over multiple
22 lines, but the additional lines must start with six spaces (i.e. be indented to match
23 "julia>"). The rest of the code is assumed to be output from the executed code and will be
24 left un-highlighted.
25
26 Using simply spaces to identify line continuations may get a false-positive if the output
27 also prints out six spaces, but such cases should be rare.
28 */
29
30 function juliaRepl(hljs) {
31 return {
32 name: 'Julia REPL',
33 contains: [
34 {
35 className: 'meta.prompt',
36 begin: /^julia>/,
37 relevance: 10,
38 starts: {
39 // end the highlighting if we are on a new line and the line does not have at
40 // least six spaces in the beginning
41 end: /^(?![ ]{6})/,
42 subLanguage: 'julia'
43 },
44 },
45 ],
46 // jldoctest Markdown blocks are used in the Julia manual and package docs indicate
47 // code snippets that should be verified when the documentation is built. They can be
48 // either REPL-like or script-like, but are usually REPL-like and therefore we apply
49 // julia-repl highlighting to them. More information can be found in Documenter's
50 // manual: https://juliadocs.github.io/Documenter.jl/latest/man/doctests.html
51 aliases: [ 'jldoctest' ],
52 };
53 }
54
55 return juliaRepl;
56
57 })();
58 ;
59 export default hljsGrammar;