From 994fef8eff5eec47fdc245fdbb8ec53d0b84ef5c Mon Sep 17 00:00:00 2001 From: Yuto Horikawa Date: Wed, 23 Feb 2022 18:39:31 +0900 Subject: [PATCH] Add documentation with Documenter.jl (#68) * add docs * update gitignore * add docs in ci.yml * update document badges in README * Update docs/Project.toml Co-authored-by: Seth Axen * Update docs/src/index.md Co-authored-by: Seth Axen Co-authored-by: Seth Axen --- .github/workflows/ci.yml | 16 ++++++++++++++++ .gitignore | 3 ++- README.md | 2 ++ docs/Project.toml | 2 ++ docs/make.jl | 22 ++++++++++++++++++++++ docs/src/index.md | 25 +++++++++++++++++++++++++ 6 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 docs/Project.toml create mode 100644 docs/make.jl create mode 100644 docs/src/index.md diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7b44c548..005d155c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,3 +53,19 @@ jobs: - uses: codecov/codecov-action@v1 with: file: lcov.info + docs: + name: Documentation + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: julia-actions/setup-julia@v1 + with: + version: '1' + - run: julia --project=docs -e ' + using Pkg; + Pkg.develop(PackageSpec(; path=pwd())); + Pkg.instantiate();' + - run: julia --project=docs docs/make.jl + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} diff --git a/.gitignore b/.gitignore index 90d0e4af..e3d8b833 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ -/Manifest.toml +Manifest.toml /test/coverage/Manifest.toml +docs/build diff --git a/README.md b/README.md index 3f582d3d..204e3158 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # Quaternions.jl A Julia module with quaternion, octonion and dual-quaternion functionality +[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://JuliaGeometry.github.io/Quaternions.jl/stable) +[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://JuliaGeometry.github.io/Quaternions.jl/dev) [![Build Status](https://github.com/JuliaGeometry/Quaternions.jl/workflows/CI/badge.svg)](https://github.com/JuliaGeometry/Quaternions.jl/actions?query=workflow%3ACI+branch%3Amaster) [![codecov](https://codecov.io/gh/JuliaGeometry/Quaternions.jl/branch/master/graph/badge.svg?token=dJBiR91dCD)](https://codecov.io/gh/JuliaGeometry/Quaternions.jl) diff --git a/docs/Project.toml b/docs/Project.toml new file mode 100644 index 00000000..dfa65cd1 --- /dev/null +++ b/docs/Project.toml @@ -0,0 +1,2 @@ +[deps] +Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" diff --git a/docs/make.jl b/docs/make.jl new file mode 100644 index 00000000..c90f7c82 --- /dev/null +++ b/docs/make.jl @@ -0,0 +1,22 @@ +using Quaternions +using Documenter + +DocMeta.setdocmeta!(Quaternions, :DocTestSetup, :(using Quaternions); recursive=true) + +makedocs(; + modules=[Quaternions], + repo="https://github.com/JuliaGeometry/Quaternions.jl/blob/{commit}{path}#{line}", + sitename="Quaternions.jl", + format=Documenter.HTML(; + prettyurls=get(ENV, "CI", "false") == "true", + canonical="https://JuliaGeometry.github.io/Quaternions.jl", + assets = ["assets/custom.css"], + ), + pages=[ + "Home" => "index.md", + ], +) + +deploydocs(; + repo="github.com/JuliaGeometry/Quaternions.jl", +) diff --git a/docs/src/index.md b/docs/src/index.md new file mode 100644 index 00000000..0cd4dda2 --- /dev/null +++ b/docs/src/index.md @@ -0,0 +1,25 @@ +# Quaternions.jl + +A Julia package implementing [quaternions](https://en.wikipedia.org/wiki/Quaternion), [octonions](https://en.wikipedia.org/wiki/Octonion) and [dual-quaternions](https://en.wikipedia.org/wiki/Dual_quaternion) + +!!! note "Documentation" + The documentation is still work in progress. + For more information, see also + * [README in the repository](https://github.com/JuliaGeometry/Quaternions.jl) + * [Tests in the repository](https://github.com/JuliaGeometry/Quaternions.jl/tree/master/test) + Feel free to [open pull requests](https://github.com/JuliaGeometry/Quaternions.jl/pulls) and improve this document! + +## Installation +``` +pkg> add Quaternions +``` + +## First example + +```@repl +using Quaternions +q = quat(0.0, 0.0, 0.0, 1.0) +r = quat(0, 0, 1, 0) +q*r +q+r +```