@@ -31,7 +31,7 @@ function servedocs_callback(fp::AbstractString, vwf::Vector{WatchedFile}, makejl
31
31
# changes from docs/src create change in docs/build which trigger a pass which
32
32
# regenerates files in docs/build etc...
33
33
if ismakejl || occursin (joinpath (" docs" , " src" ), fp)
34
- include (makejl)
34
+ Main . include (makejl)
35
35
file_changed_callback (fp)
36
36
end
37
37
return nothing
@@ -60,25 +60,27 @@ function scan_docs!(dw::SimpleWatcher)
60
60
end
61
61
62
62
"""
63
- servedocs()
63
+ servedocs(; verbose=false )
64
64
65
- Can be used when developping a package to run the `docs/make.jl` file from Documenter.jl and
65
+ Can be used when developing a package to run the `docs/make.jl` file from Documenter.jl and
66
66
then serve the `docs/build` folder with LiveServer.jl. This function assumes you are in the
67
67
directory `[MyPackage].jl` with a subfolder `docs`.
68
+
69
+ * `verbose` is a boolean switch to make the server print information about file changes and connections.
68
70
"""
69
- function servedocs ()
71
+ function servedocs (; verbose :: Bool = false )
70
72
# Custom file watcher: it's the standard `SimpleWatcher` but with a custom callback.
71
73
docwatcher = SimpleWatcher ()
72
74
set_callback! (docwatcher, fp-> servedocs_callback (fp, docwatcher. watchedfiles, makejl))
73
75
74
76
makejl = scan_docs! (docwatcher)
75
77
76
78
# trigger a first pass of Documenter
77
- include (makejl)
79
+ Main . include (makejl)
78
80
79
81
# note the `docs/build` exists here given that if we're here it means the documenter
80
82
# pass did not error and therefore that a docs/build has been generated.
81
- serve (docwatcher, dir= joinpath (" docs" , " build" ))
83
+ serve (docwatcher, dir= joinpath (" docs" , " build" ), verbose = verbose )
82
84
83
85
return nothing
84
86
end
0 commit comments