1
0
Fork 0
management/front/dkha-web-sz-main/node_modules/highlight.js/lib/languages/julia-repl.js

51 lines
1.7 KiB
JavaScript
Raw Normal View History

2024-01-16 21:26:16 +08:00
/*
Language: Julia REPL
Description: Julia REPL sessions
Author: Morten Piibeleht <morten.piibeleht@gmail.com>
Website: https://julialang.org
Requires: julia.js
The Julia REPL code blocks look something like the following:
julia> function foo(x)
x + 1
end
foo (generic function with 1 method)
They start on a new line with "julia>". Usually there should also be a space after this, but
we also allow the code to start right after the > character. The code may run over multiple
lines, but the additional lines must start with six spaces (i.e. be indented to match
"julia>"). The rest of the code is assumed to be output from the executed code and will be
left un-highlighted.
Using simply spaces to identify line continuations may get a false-positive if the output
also prints out six spaces, but such cases should be rare.
*/
function juliaRepl(hljs) {
2023-12-18 13:12:25 +08:00
return {
2024-01-16 21:26:16 +08:00
name: 'Julia REPL',
2023-12-18 13:12:25 +08:00
contains: [
{
className: 'meta',
begin: /^julia>/,
relevance: 10,
starts: {
// end the highlighting if we are on a new line and the line does not have at
// least six spaces in the beginning
end: /^(?![ ]{6})/,
subLanguage: 'julia'
},
// jldoctest Markdown blocks are used in the Julia manual and package docs indicate
// code snippets that should be verified when the documentation is built. They can be
// either REPL-like or script-like, but are usually REPL-like and therefore we apply
// julia-repl highlighting to them. More information can be found in Documenter's
// manual: https://juliadocs.github.io/Documenter.jl/latest/man/doctests.html
aliases: ['jldoctest']
}
]
}
2024-01-16 21:26:16 +08:00
}
module.exports = juliaRepl;