Skip to content

Commit c2cf31b

Browse files
authored
host and port kwargs for servedocs (#117)
1 parent 4e26c78 commit c2cf31b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/utils.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,16 @@ assumed that they are in `docs/src`.
122122
* `skip_dirs=[]` same as `skip_dir` but for a vector of such dirs. Takes precedence over `skip_dir`.
123123
* `foldername="docs"` specify the name of the content folder if different than "docs".
124124
* `buildfoldername="build"` specify the name of the build folder if different than "build".
125+
* `host="127.0.0.1"` where the server will start.
126+
* `port` is an integer between 8000 (default) and 9000.
125127
* `launch_browser=false` specifies whether to launch the ambient browser at the localhost URL or not.
126128
"""
127129
function servedocs(; verbose::Bool=false, literate::String="",
128130
doc_env::Bool=false, skip_dir::String="",
129131
skip_dirs::Vector{String}=String[],
130132
foldername::String="docs",
131133
buildfoldername::String="build",
134+
host::String="127.0.0.1", port::Int=8000,
132135
launch_browser::Bool = false)
133136
# Custom file watcher: it's the standard `SimpleWatcher` but with a custom callback.
134137
docwatcher = SimpleWatcher()
@@ -151,7 +154,7 @@ function servedocs(; verbose::Bool=false, literate::String="",
151154

152155
# note the `docs/build` exists here given that if we're here it means the documenter
153156
# pass did not error and therefore that a docs/build has been generated.
154-
serve(docwatcher, dir=joinpath(foldername, buildfoldername), verbose=verbose, launch_browser=launch_browser)
157+
serve(docwatcher, host=host, port=port, dir=joinpath(foldername, buildfoldername), verbose=verbose, launch_browser=launch_browser)
155158
if doc_env
156159
Pkg.activate()
157160
end

0 commit comments

Comments
 (0)