Skip to content

Commit

Permalink
Add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
sloede committed Jan 16, 2024
1 parent fdad672 commit 72169bb
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/
5 changes: 5 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"

[compat]
Documenter = "1"
73 changes: 73 additions & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
using Documenter

# Get TrixiBase.jl root directory
trixibase_root_dir = dirname(@__DIR__)

# Fix for https://github.com/trixi-framework/Trixi.jl/issues/668
if (get(ENV, "CI", nothing) != "true") && (get(ENV, "TRIXIBASE_DOC_DEFAULT_ENVIRONMENT", nothing) != "true")
push!(LOAD_PATH, trixibase_root_dir)
end

using TrixiBase

# Define module-wide setups such that the respective modules are available in doctests
DocMeta.setdocmeta!(TrixiBase, :DocTestSetup, :(using TrixiBase); recursive=true)

# Copy some files from the top level directory to the docs and modify them
# as necessary
open(joinpath(@__DIR__, "src", "index.md"), "w") do io
# Point to source file
println(io, """
```@meta
EditURL = "https://github.com/trixi-framework/TrixiBase.jl/blob/main/README.md"
```
""")
# Write the modified contents
for line in eachline(joinpath(trixibase_root_dir, "README.md"))
line = replace(line, "[LICENSE.md](LICENSE.md)" => "[License](@ref)")
println(io, line)
end
end

# open(joinpath(@__DIR__, "src", "license.md"), "w") do io
# # Point to source file
# println(io, """
# ```@meta
# EditURL = "https://github.com/trixi-framework/TrixiBase.jl/blob/main/LICENSE.md"
# ```
# """)
# # Write the modified contents
# println(io, "# License")
# println(io, "")
# for line in eachline(joinpath(trixibase_root_dir, "LICENSE.md"))
# println(io, "> ", line)
# end
# end

# Make documentation
makedocs(
# Specify modules for which docstrings should be shown
modules = [TrixiBase],
# Set sitename to Trixi.jl
sitename="TrixiBase.jl",
# Provide additional formatting options
format = Documenter.HTML(
# Disable pretty URLs during manual testing
prettyurls = get(ENV, "CI", nothing) == "true",
# Set canonical URL to GitHub pages URL
canonical = "https://trixi-framework.github.io/TrixiBase.jl/stable"
),
# Explicitly specify documentation structure
pages = [
"Home" => "index.md",
"API reference" => "reference.md",
# "License" => "license.md"
],
)


deploydocs(;
repo = "github.com/trixi-framework/TrixiBase.jl",
devbranch = "main",
push_preview = true
)
2 changes: 2 additions & 0 deletions docs/src/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
index.md
license.md
9 changes: 9 additions & 0 deletions docs/src/reference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# API reference

```@meta
CurrentModule = TrixiBase
```

```@autodocs
Modules = [TrixiBase]
```
5 changes: 5 additions & 0 deletions src/TrixiBase.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
module TrixiBase

"""
greet()
Please, welcome everyone!
"""
greet() = print("Hello World!")

end # module TrixiBase

0 comments on commit 72169bb

Please sign in to comment.