Skip to content

Commit efd9a22

Browse files
authored
Clean up documentation (#423)
* Add precommit * literate cleanup * Update welcome * Add markdown to formatter and run, fix hyperlinks * Add interlinks and prettyurls * Add PSY extref hyperlinks * Add hyperlinks * Add PSCB to interlinks and hyperlinks to tutorials * Update modeler guide refs * Fix old nrel-sienna links * Remove contributed by * Remove excess lines * Fix nrel link * Add basic missing docstrings
1 parent 77b8b4b commit efd9a22

45 files changed

Lines changed: 635 additions & 433 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Doc Preview Cleanup
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
7+
# Ensure that only one "Doc Preview Cleanup" workflow is force pushing at a time
8+
concurrency:
9+
group: doc-preview-cleanup
10+
cancel-in-progress: false
11+
12+
jobs:
13+
doc-preview-cleanup:
14+
runs-on: ubuntu-latest
15+
if: github.event.pull_request.head.repo.fork == false
16+
# This workflow pushes to gh-pages; permissions are per-job and independent of docs.yml
17+
permissions:
18+
contents: write
19+
steps:
20+
- name: Checkout gh-pages branch
21+
uses: actions/checkout@v4
22+
with:
23+
ref: gh-pages
24+
- name: Delete preview and history + push changes
25+
run: |
26+
if [ -d "${preview_dir}" ]; then
27+
git config user.name "Documenter.jl"
28+
git config user.email "documenter@juliadocs.github.io"
29+
git rm -rf "${preview_dir}"
30+
git commit -m "delete preview"
31+
git branch gh-pages-new "$(echo "delete history" | git commit-tree "HEAD^{tree}")"
32+
git push --force origin gh-pages-new:gh-pages
33+
fi
34+
env:
35+
preview_dir: previews/PR${{ github.event.number }}

.github/workflows/docs.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ jobs:
1818
version: 1
1919
- name: Install dependencies
2020
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
21+
22+
- name: Set DOCUMENTER_CURRENT_VERSION for tutorial download links
23+
run: |
24+
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
25+
echo "DOCUMENTER_CURRENT_VERSION=previews/PR${{ github.event.pull_request.number }}" >> "$GITHUB_ENV"
26+
elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
27+
echo "DOCUMENTER_CURRENT_VERSION=${GITHUB_REF_NAME}" >> "$GITHUB_ENV"
28+
elif [[ "${{ github.ref }}" == "refs/heads/main" ]] || [[ "${{ github.ref }}" =~ ^refs/heads/release- ]]; then
29+
echo "DOCUMENTER_CURRENT_VERSION=dev" >> "$GITHUB_ENV"
30+
fi
2131
- name: Build and deploy
2232
env:
2333
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.pre-commit-config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
repos:
2+
- repo: local
3+
hooks:
4+
- id: julia-formatter
5+
name: Run Julia formatter
6+
entry: julia scripts/formatter/formatter_code.jl
7+
language: system
8+
types: [file]
9+
pass_filenames: false

docs/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
33
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
44
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
5+
DocumenterInterLinks = "d12716ef-a0f6-4df4-a9f1-a5a34e75c656"
56
DocumenterTools = "35a29f4d-8980-5a13-9543-d66fff28ecb8"
67
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
78
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"

docs/make.jl

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
using Documenter, PowerSystems, DocStringExtensions, PowerSimulationsDynamics
2-
3-
const _DOCS_BASE_URL = "https://sienna-platform.github.io/PowerSimulationsDynamics.jl/stable"
2+
using DocumenterInterLinks
43

54
include(joinpath(@__DIR__, "make_tutorials.jl"))
65
make_tutorials()
76

7+
links = InterLinks(
8+
"PowerSystems" => "https://sienna-platform.github.io/PowerSystems.jl/stable/",
9+
"PowerSystemCaseBuilder" => "https://sienna-platform.github.io/PowerSystemCaseBuilder.jl/stable/",
10+
)
11+
812
makedocs(;
913
modules = [PowerSimulationsDynamics],
10-
format = Documenter.HTML(; mathengine = Documenter.MathJax()),
14+
format = Documenter.HTML(;
15+
prettyurls = haskey(ENV, "GITHUB_ACTIONS"),
16+
mathengine = Documenter.MathJax(),
17+
),
1118
sitename = "PowerSimulationsDynamics.jl",
19+
plugins = [links],
1220
pages = Any[
1321
"Welcome Page" => "index.md",
1422
"Quick Start Guide" => "tutorials/generated_quick_start_guide.md",

0 commit comments

Comments
 (0)