Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions DocsDocumenter/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ inputs:
description: 'Whether to deploy the docs to the gh-pages branch'
required: false
default: 'true'
use-vitepress:
description: 'Whether to use DocumenterVitepress.deploydocs() instead of Documenter.deploydocs() for deployment. Requires DocumenterVitepress to be listed in the docs Project.toml.'
required: false
default: 'false'
post-preview-comment:
description: 'Whether to post a pull request preview comment after deployment'
required: false
Expand Down Expand Up @@ -112,6 +116,14 @@ runs:
- name: Build docs
shell: bash
run: julia --project=${{ inputs.doc-path }} ${{ inputs.doc-make-path }}
# `DocumenterVitepress`'s writer calls `Documenter.deploy_folder(...)`
# at build time to decide the `bases` it writes to `build/bases.txt`.
# `deploy_folder` requires `GITHUB_TOKEN` to be present to recognise
# a CI build; without it the writer falls back to `all_ok=false`,
# `subfolder=""`, and the later deploy step finds an empty bases list
# and skips. Expose the token so PR-preview deploys work end-to-end.
env:
GITHUB_TOKEN: ${{ github.token }}

# We want to use the same version of DocsNav. In principle we would like
# to write `uses: TuringLang/actions/DocsNav@${{ github.action_ref }}`,
Expand Down Expand Up @@ -142,8 +154,14 @@ runs:
# Must pass `root` when `deploydocs()` is run from outside make.jl file
# Also, `root` must be an absolute path (hence the call to `pwd()`)
run: |
using Documenter
deploydocs(; root=pwd(), repo="github.com/${{ github.repository }}.git", dirname="${{ inputs.dirname }}", tag_prefix="${{ inputs.tag_prefix }}", push_preview=true)
use_vitepress = "${{ inputs.use-vitepress }}" == "true"
if use_vitepress
using DocumenterVitepress
DocumenterVitepress.deploydocs(; root=pwd(), repo="github.com/${{ github.repository }}.git", dirname="${{ inputs.dirname }}", tag_prefix="${{ inputs.tag_prefix }}", push_preview=true)
else
using Documenter
deploydocs(; root=pwd(), repo="github.com/${{ github.repository }}.git", dirname="${{ inputs.dirname }}", tag_prefix="${{ inputs.tag_prefix }}", push_preview=true)
end
env:
GITHUB_TOKEN: ${{ github.token }}
JULIA_DEBUG: Documenter
Expand Down
35 changes: 35 additions & 0 deletions DocsNav/scripts/TuringNavbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,41 @@
}
/* End of Documenter.jl Tweaks */

/* DocumenterVitepress integration:
Vitepress's default theme already exposes `--vp-layout-top-height` as
the hook for adding banner-style chrome above its own nav. Every
layout-sensitive component (`.VPNav` `top`, `.VPContent` `margin`,
`.VPSidebar` `top`, `.VPLocalNav` `padding-top`, `.VPDocAside` `top`
and TOC `padding-top`) is already authored to add this variable to
its own offset, so binding it to the TuringLang navbar height makes
Vitepress reflow itself correctly with zero further intervention.
(`:has(.VPNavBar)` scopes this to Vitepress builds; Documenter HTML
sites are untouched.) */
html:has(.VPNavBar) {
--vp-layout-top-height: var(--navbar-height);
}

/* When the rendered site is Vitepress (detected by .VPNavBar being in the
DOM), adopt Vitepress's design tokens so the TuringLang navbar tracks
the active theme (light/dark, brand colour, body font) and reads as one
piece of chrome with the Vitepress nav below it — rather than a stacked
second header with its own colour and typography. */
html:has(.VPNavBar) {
--primary-bg: var(--vp-c-bg);
--heading-color: var(--vp-c-text-1);
--item-color: var(--vp-c-text-2);
--icon-color: var(--vp-c-text-1);
--hover-color: var(--vp-c-brand-1);
--shadow-color: var(--vp-c-divider);
--dropdown-hover-bg: var(--vp-c-default-soft);
--font-family: var(--vp-font-family-base);
}
html:has(.VPNavBar) .ext-navigation {
box-shadow: none;
border-bottom: 1px solid var(--vp-c-divider);
}
/* End of DocumenterVitepress Tweaks */

/* Color and Font Variables */
:root {
--heading-color: #6c757d;
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ If your `docs/make.jl` file contains a call to `deploydocs()`, it is not a big d
| `julia-version` | Julia version to use | `'1'` |
| `exclude-paths` | JSON array of filepath patterns to exclude from navbar insertion | `"[]"` |
| `deploy` | Whether to deploy to the `gh-pages` branch or not | `true` |
| `use-vitepress` | Use `DocumenterVitepress.deploydocs()` instead of `Documenter.deploydocs()`. Requires `DocumenterVitepress` in the docs `Project.toml`. | `false` |
| `post-preview-comment` | Whether to post the sticky pull request preview comment after deployment | `true` |

### Outputs
Expand Down