main
Last change
on this file since cfc16a3 was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1.7 KB
|
Rev | Line | |
---|
[d24f17c] | 1 | /*
|
---|
| 2 | Language: Julia REPL
|
---|
| 3 | Description: Julia REPL sessions
|
---|
| 4 | Author: Morten Piibeleht <morten.piibeleht@gmail.com>
|
---|
| 5 | Website: https://julialang.org
|
---|
| 6 | Requires: julia.js
|
---|
| 7 |
|
---|
| 8 | The Julia REPL code blocks look something like the following:
|
---|
| 9 |
|
---|
| 10 | julia> function foo(x)
|
---|
| 11 | x + 1
|
---|
| 12 | end
|
---|
| 13 | foo (generic function with 1 method)
|
---|
| 14 |
|
---|
| 15 | They start on a new line with "julia>". Usually there should also be a space after this, but
|
---|
| 16 | we also allow the code to start right after the > character. The code may run over multiple
|
---|
| 17 | lines, but the additional lines must start with six spaces (i.e. be indented to match
|
---|
| 18 | "julia>"). The rest of the code is assumed to be output from the executed code and will be
|
---|
| 19 | left un-highlighted.
|
---|
| 20 |
|
---|
| 21 | Using simply spaces to identify line continuations may get a false-positive if the output
|
---|
| 22 | also prints out six spaces, but such cases should be rare.
|
---|
| 23 | */
|
---|
| 24 |
|
---|
| 25 | function juliaRepl(hljs) {
|
---|
| 26 | return {
|
---|
| 27 | name: 'Julia REPL',
|
---|
| 28 | contains: [
|
---|
| 29 | {
|
---|
| 30 | className: 'meta',
|
---|
| 31 | begin: /^julia>/,
|
---|
| 32 | relevance: 10,
|
---|
| 33 | starts: {
|
---|
| 34 | // end the highlighting if we are on a new line and the line does not have at
|
---|
| 35 | // least six spaces in the beginning
|
---|
| 36 | end: /^(?![ ]{6})/,
|
---|
| 37 | subLanguage: 'julia'
|
---|
| 38 | },
|
---|
| 39 | // jldoctest Markdown blocks are used in the Julia manual and package docs indicate
|
---|
| 40 | // code snippets that should be verified when the documentation is built. They can be
|
---|
| 41 | // either REPL-like or script-like, but are usually REPL-like and therefore we apply
|
---|
| 42 | // julia-repl highlighting to them. More information can be found in Documenter's
|
---|
| 43 | // manual: https://juliadocs.github.io/Documenter.jl/latest/man/doctests.html
|
---|
| 44 | aliases: ['jldoctest']
|
---|
| 45 | }
|
---|
| 46 | ]
|
---|
| 47 | }
|
---|
| 48 | }
|
---|
| 49 |
|
---|
| 50 | module.exports = juliaRepl;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.