Skip to content

Commit e4d5dd6

Browse files
authored
Update syntax highlight tags for example code blocks (#967)
Mostly add `julia-repl` for more specific highlighting.
1 parent 8e842bf commit e4d5dd6

File tree

6 files changed

+22
-22
lines changed

6 files changed

+22
-22
lines changed

docs/src/config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ fs.inotify.max_user_watches = 524288
167167
```
168168

169169
For Revise usage, `max_user_watches >= 65536` is recommended, and more can be helpful; the value of 524288 above is common on modern systems. One can set higher values as needed, e.g.,
170-
```
170+
```sh
171171
$ sudo sysctl fs.inotify.max_user_instances=2048
172172
```
173173
After changing these values, it is advised to run Revise's unit tests to see if they pass.

docs/src/cookbook.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Both options are described below.
4545

4646
Let's create a new package, `MyPkg`, to play with.
4747

48-
```julia
48+
```julia-repl
4949
julia> using PkgTemplates
5050
5151
julia> t = Template()
@@ -73,15 +73,15 @@ the directory `/home/tim/.julia/dev/MyPkg`.
7373
Press `]` to enter the [Pkg REPL](https://pkgdocs.julialang.org/v1/getting-started/#Basic-Usage).
7474
Then add the new package to your current environment with the `dev` command.
7575

76-
```julia
76+
```julia-repl
7777
(<environment>) pkg> dev MyPkg # the dev command will look in the ~/.julia/dev folder automatically
7878
```
7979

8080
Press the backspace key to return to the Julia REPL.
8181

8282
Now let's try it out:
8383

84-
```julia
84+
```julia-repl
8585
julia> using Revise # you must do this before loading any revisable packages
8686
8787
julia> using MyPkg
@@ -94,7 +94,7 @@ You'll note that Julia found your package without you having to take any extra s
9494
*Without* quitting this Julia session, open the `MyPkg.jl` file in an editor.
9595
You might be able to open it with
9696

97-
```julia
97+
```julia-repl
9898
julia> edit(pathof(MyPkg))
9999
```
100100

@@ -124,7 +124,7 @@ end # module
124124
Now go back to that same Julia session, and try calling `greet`.
125125
After a pause (while Revise's internal code compiles), you should see
126126

127-
```julia
127+
```julia-repl
128128
julia> MyPkg.greet()
129129
Hello World!
130130
```
@@ -141,7 +141,7 @@ Let's create a blank `MyPkg` using `Pkg`. (If you tried the `PkgTemplates` versi
141141
above, you might first have to delete the package with `Pkg.rm("MyPkg")` following by
142142
a complete removal from your `dev` directory.)
143143

144-
```julia
144+
```julia-repl
145145
julia> using Revise, Pkg
146146
147147
julia> cd(Pkg.devdir()) # take us to the standard "development directory"
@@ -161,7 +161,7 @@ then type `generate MyPkg`.
161161
The next line, `dev MyPkg`, is necessary to tell `Pkg` about the existence of this new package.
162162

163163
Now you can do the following:
164-
```julia
164+
```julia-repl
165165
julia> using MyPkg
166166
[ Info: Precompiling MyPkg [efe7ebfe-4313-4388-9b6c-3590daf47143]
167167
@@ -193,7 +193,7 @@ Save it as `mygreet.jl` in some directory. Here we will assume it's being saved
193193

194194
Now load the code with `includet`, which stands for "include and track":
195195

196-
```julia
196+
```julia-repl
197197
julia> using Revise
198198
199199
julia> includet("/tmp/mygreet.jl")
@@ -210,7 +210,7 @@ mygreeting() = "Hello, revised world!"
210210

211211
and then try it in the same session:
212212

213-
```julia
213+
```julia-repl
214214
julia> mygreeting()
215215
"Hello, revised world!"
216216
```

docs/src/internals.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Revise is based on the fact that you can change functions even when
88
they are defined in other modules.
99
Here's an example showing how you do that manually (without using Revise):
1010

11-
```julia
11+
```julia-repl
1212
julia> convert(Float64, π)
1313
3.141592653589793
1414
@@ -149,14 +149,14 @@ There are several reasons that make this an attractive approach, of which the mo
149149
- for methods generated by code, the only really reliable mechanism to compute all the signatures is to step through the code that generates the methods. That is performed using [JuliaInterpreter](https://github.com/JuliaDebug/JuliaInterpreter.jl).
150150

151151
As an example, suppose the following code is part of your module definition:
152-
```
152+
```julia
153153
for T in (Float16, Float32, Float64)
154154
@eval sizefloat(x::$T) = sizeof($T)
155155
end
156156
```
157157
!!! tip "clarification"
158158
This is equivalent to the following explicit definitions:
159-
```
159+
```julia
160160
sizefloat(x::Float16) = 2
161161
sizefloat(x::Float32) = 4
162162
sizefloat(x::Float64) = 8
@@ -166,7 +166,7 @@ If you replace the loop with `for T in (Float32, Float64)`, then Revise should d
166166

167167
Because lowered code is far simpler than ordinary Julia code, it is much easier to interpret. Let's look briefly at a method definition:
168168

169-
```
169+
```julia
170170
floatwins(x::AbstractFloat, y::Integer) = x
171171
```
172172

@@ -297,7 +297,7 @@ indent(::UInt8) = 4
297297
If you create this as a mini-package and then say `using Revise, Items`, you can start
298298
examining internal variables in the following manner:
299299

300-
```julia
300+
```julia-repl
301301
julia> id = Base.PkgId(Items)
302302
Items [b24a5932-55ed-11e9-2a88-e52f99e65a0d]
303303
@@ -310,7 +310,7 @@ PkgData(Items [b24a5932-55ed-11e9-2a88-e52f99e65a0d]:
310310
(Your specific UUID may differ.)
311311

312312
Path information is stored in `pkgdata.info`:
313-
```julia
313+
```julia-repl
314314
julia> pkgdata.info
315315
PkgFiles(Items [b24a5932-55ed-11e9-2a88-e52f99e65a0d]):
316316
basedir: "/tmp/pkgs/Items"
@@ -323,7 +323,7 @@ package manager.
323323

324324
`src/indents.jl` is particularly simple:
325325

326-
```julia
326+
```julia-repl
327327
julia> pkgdata.fileinfos[2]
328328
FileInfo(Items=>ExprsSigs with the following expressions:
329329
:(indent(::UInt16) = begin
@@ -336,7 +336,7 @@ FileInfo(Items=>ExprsSigs with the following expressions:
336336

337337
This is just a summary; to see the actual `def=>mt_sigts` map, do the following:
338338

339-
```julia
339+
```julia-repl
340340
julia> pkgdata.fileinfos[2].modexsigs[Items]
341341
OrderedCollections.OrderedDict{Module, OrderedCollections.OrderedDict{Revise.RelocatableExpr, Union{Nothing, Vector{Pair{Union{Nothing, Core.MethodTable}, Type}}}}} with 2 entries:
342342
:(indent(::UInt16) = begin… => Pair{Union{Nothing, MethodTable}, Type}[nothing => Tuple{typeof(indent),UInt16}]

docs/src/limitations.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ These kinds of changes require that you restart your Julia session.
1010

1111
During early stages of development, it's quite common to want to change type definitions. You can work around Julia's/Revise's limitations by temporary renaming. We'll illustrate this below, using `write` to be explicit about when updates to the file happen. But in ordinary usage, these are changes you'd likely make with your editor.
1212

13-
```julia
13+
```julia-repl
1414
julia> using Pkg, Revise
1515
1616
julia> Pkg.generate("MyPkg")
@@ -83,7 +83,7 @@ This works as long as the new type name doesn't conflict with an existing name;
8383

8484
Once your development has converged on a solution, it's best to switch to the "permanent" name: in the example above, `FooStruct` is a non-constant global variable, and if used internally in a function there will be consequent performance penalties. Switching to the permanent name will force you to restart your session.
8585

86-
```julia
86+
```julia-repl
8787
julia> isconst(MyPkg, :FooStruct)
8888
true
8989

docs/src/tricks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
Updating the code in Julia's REPL stdlib requires some extra trickery, because modified method definitions can't be deployed until you exit any currently-running REPL functions, like those handling the prompt that you're using to interact with Julia. A workaround is to create a sub-REPL that you can shut down, and then restart a new one whenever you want to test new code:
66

7-
```
7+
```julia
88
using Revise
99
using REPL
1010
Revise.track(REPL)

src/Revise.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Revise.jl tracks source code changes and incorporates the changes to a running Julia session.
33
44
Revise.jl works behind-the-scenes. To track a package, e.g. `Example`:
5-
```julia
5+
```julia-repl
66
(@v1.6) pkg> dev Example # make a development copy of the package
77
[...pkg output omitted...]
88

0 commit comments

Comments
 (0)