Skip to content

Commit 8520a55

Browse files
mortenpitkelman
authored andcommitted
Use julia-repl in documentation
With the highlighting updates in Documenter v0.10.1 it is now possible to have specialized highlighting for REPL blocks via the julia-repl attribute on code blocks. Doctests already use this, so this makes the highlighting for non-doctest REPL blocks consistent. (cherry picked from commit 014c5d5) ref #21866 Use at-repl for versioninfo() output (cherry picked from commit f67d4fd) Enable highlighting in the manual A couple of code examples were not highlighted for some reason. (cherry picked from commit b710de9) Remove highlighting from REQUIRE code These blocks are not Julia code, but special REQUIRE file syntax instead. (cherry picked from commit c90c17f) Enable bash highlighting Also add a newline to the end of the file. (cherry picked from commit 6e08c18) Use a non-deprecated package in an example UTF16.jl has been deprecated for a while. Use SHA.jl instead as the example. (cherry picked from commit 6e5c55d) Edit manual/conversion-and-promotion.md The REPL example is basically exactly as above, and does not add anything to the latter bit about the actual convert methods. (cherry picked from commit 96b65f1) Fix line numbers in doctests (cherry picked from commit 814a8a1) Enable a doctest in base/regex.jl (cherry picked from commit d9063cb) Enable doctests the the manual Switching to julia-repl revealed several code blocks that could trivially be turned into doctests. (cherry picked from commit 1d20519)
1 parent eda7690 commit 8520a55

40 files changed

+273
-281
lines changed

base/abstractarray.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ default is an `Array{element_type}(dims...)`.
489489
For example, `similar(1:10, 1, 4)` returns an uninitialized `Array{Int,2}` since ranges are
490490
neither mutable nor support 2 dimensions:
491491
492-
```julia
492+
```julia-repl
493493
julia> similar(1:10, 1, 4)
494494
1×4 Array{Int64,2}:
495495
4419743872 4374413872 4419743888 0
@@ -498,7 +498,7 @@ julia> similar(1:10, 1, 4)
498498
Conversely, `similar(trues(10,10), 2)` returns an uninitialized `BitVector` with two
499499
elements since `BitArray`s are both mutable and can support 1-dimensional arrays:
500500
501-
```julia
501+
```julia-repl
502502
julia> similar(trues(10,10), 2)
503503
2-element BitArray{1}:
504504
false
@@ -508,7 +508,7 @@ julia> similar(trues(10,10), 2)
508508
Since `BitArray`s can only store elements of type `Bool`, however, if you request a
509509
different element type it will create a regular `Array` instead:
510510
511-
```julia
511+
```julia-repl
512512
julia> similar(falses(10), Float64, 2, 4)
513513
2×4 Array{Float64,2}:
514514
2.18425e-314 2.18425e-314 2.18425e-314 2.18425e-314

base/array.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ julia> resize!([6, 5, 4, 3, 2, 1], 3)
718718
4
719719
```
720720
721-
```julia
721+
```julia-repl
722722
julia> resize!([6, 5, 4, 3, 2, 1], 8)
723723
8-element Array{Int64,1}:
724724
6

base/bitarray.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ end
3535
Construct an uninitialized `BitArray` with the given dimensions.
3636
Behaves identically to the [`Array`](@ref) constructor.
3737
38-
```julia
38+
```julia-repl
3939
julia> BitArray(2, 2)
4040
2×2 BitArray{2}:
4141
false false

base/distributed/pmap.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ which is then returned inline with the results to the caller.
6060
6161
Consider the following two examples. The first one returns the exception object inline,
6262
the second a 0 in place of any exception:
63-
```julia
63+
```julia-repl
6464
julia> pmap(x->iseven(x) ? error("foo") : x, 1:4; on_error=identity)
6565
4-element Array{Any,1}:
6666
1

base/docs/helpdb/Base.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1949,7 +1949,7 @@ julia> convert(Int, 3.0)
19491949
julia> convert(Int, 3.5)
19501950
ERROR: InexactError()
19511951
Stacktrace:
1952-
[1] convert(::Type{Int64}, ::Float64) at ./float.jl:679
1952+
[1] convert(::Type{Int64}, ::Float64) at ./float.jl:680
19531953
```
19541954
19551955
If `T` is a `AbstractFloat` or `Rational` type,

base/libgit2/libgit2.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ is in the repository.
7575
7676
# Example
7777
78-
```julia
78+
```julia-repl
7979
julia> repo = LibGit2.GitRepo(repo_path);
8080
8181
julia> LibGit2.add!(repo, test_file);
@@ -220,7 +220,7 @@ Returns `true` if `a`, a [`GitHash`](@ref) in string form, is an ancestor of
220220
221221
# Example
222222
223-
```julia
223+
```julia-repl
224224
julia> repo = LibGit2.GitRepo(repo_path);
225225
226226
julia> LibGit2.add!(repo, test_file1);
@@ -954,4 +954,3 @@ end
954954

955955

956956
end # module
957-

base/libgit2/reference.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ end
4848
Returns a shortened version of the name of `ref` that's
4949
"human-readable".
5050
51-
```julia
51+
```julia-repl
5252
julia> repo = LibGit2.GitRepo(path_to_repo);
5353
5454
julia> branch_ref = LibGit2.head(repo);

base/libgit2/remote.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Get the URL of a remote git repository.
7878
7979
# Example
8080
81-
```julia
81+
```julia-repl
8282
julia> repo_url = "https://github.com/JuliaLang/Example.jl";
8383
8484
julia> repo = LibGit2.clone(cache_repo, "test_directory");
@@ -104,7 +104,7 @@ the name will be an empty string `""`.
104104
105105
# Example
106106
107-
```julia
107+
```julia-repl
108108
julia> repo_url = "https://github.com/JuliaLang/Example.jl";
109109
110110
julia> repo = LibGit2.clone(cache_repo, "test_directory");
@@ -158,7 +158,7 @@ Add a *fetch* refspec for the specified `rmt`. This refspec will contain
158158
information about which branch(es) to fetch from.
159159
160160
# Example
161-
```julia
161+
```julia-repl
162162
julia> LibGit2.add_fetch!(repo, remote, "upstream");
163163
164164
julia> LibGit2.fetch_refspecs(remote)
@@ -178,7 +178,7 @@ Add a *push* refspec for the specified `rmt`. This refspec will contain
178178
information about which branch(es) to push to.
179179
180180
# Example
181-
```julia
181+
```julia-repl
182182
julia> LibGit2.add_push!(repo, remote, "refs/heads/master");
183183
184184
julia> remote = LibGit2.get(LibGit2.GitRemote, repo, branch);

base/multidimensional.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@ their indices; any offset results in a (circular) wraparound. If the
903903
arrays have overlapping indices, then on the domain of the overlap
904904
`dest` agrees with `src`.
905905
906-
```julia
906+
```julia-repl
907907
julia> src = reshape(collect(1:16), (4,4))
908908
4×4 Array{Int64,2}:
909909
1 5 9 13

base/regex.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ after the ending quote, to change its behaviour:
7575
7676
For example, this regex has all three flags enabled:
7777
78-
```julia
78+
```jldoctest
7979
julia> match(r"a+.*b+.*?d\$"ism, "Goodbye,\\nOh, angry,\\nBad world\\n")
8080
RegexMatch("angry,\\nBad world")
8181
```

0 commit comments

Comments
 (0)