Skip to content

Commit

Permalink
host and port kwargs for servedocs (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
cserteGT3 authored Mar 4, 2021
1 parent 4e26c78 commit c2cf31b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,16 @@ assumed that they are in `docs/src`.
* `skip_dirs=[]` same as `skip_dir` but for a vector of such dirs. Takes precedence over `skip_dir`.
* `foldername="docs"` specify the name of the content folder if different than "docs".
* `buildfoldername="build"` specify the name of the build folder if different than "build".
* `host="127.0.0.1"` where the server will start.
* `port` is an integer between 8000 (default) and 9000.
* `launch_browser=false` specifies whether to launch the ambient browser at the localhost URL or not.
"""
function servedocs(; verbose::Bool=false, literate::String="",
doc_env::Bool=false, skip_dir::String="",
skip_dirs::Vector{String}=String[],
foldername::String="docs",
buildfoldername::String="build",
host::String="127.0.0.1", port::Int=8000,
launch_browser::Bool = false)
# Custom file watcher: it's the standard `SimpleWatcher` but with a custom callback.
docwatcher = SimpleWatcher()
Expand All @@ -151,7 +154,7 @@ function servedocs(; verbose::Bool=false, literate::String="",

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

0 comments on commit c2cf31b

Please sign in to comment.