-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add vitepress based documentation
- Loading branch information
Showing
24 changed files
with
989 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Doc Preview Cleanup | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
|
||
jobs: | ||
doc-preview-cleanup: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout gh-pages branch | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: gh-pages | ||
- name: Delete preview and history + push changes | ||
run: | | ||
if [ -d "previews/PR$PRNUM" ]; then | ||
git config user.name "avik-pal" | ||
git config user.email "avikpal@mit.edu" | ||
git rm -rf "previews/PR$PRNUM" | ||
git commit -m "delete preview" | ||
git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree}) | ||
git push --force origin gh-pages-new:gh-pages | ||
fi | ||
env: | ||
PRNUM: ${{ github.event.number }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Sample workflow for building and deploying a VitePress site to GitHub Pages | ||
# | ||
name: Documenter | ||
|
||
on: | ||
# Runs on pushes targeting the `master` branch. Change this to `main` if you're | ||
# using the `main` branch as the default branch. | ||
push: | ||
branches: | ||
- main | ||
tags: ['*'] | ||
pull_request: | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
permissions: | ||
contents: write | ||
pages: write | ||
id-token: write | ||
statuses: write | ||
|
||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | ||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | ||
concurrency: | ||
group: pages | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
# Build job | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Julia | ||
uses: julia-actions/setup-julia@v1 | ||
- name: Pull Julia cache | ||
uses: julia-actions/cache@v1 | ||
- name: Install documentation dependencies | ||
run: julia --project=docs -e 'using Pkg; pkg"dev ."; Pkg.instantiate(); Pkg.precompile(); Pkg.status()' | ||
- name: Build and deploy docs | ||
uses: julia-actions/julia-docdeploy@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For authentication with GitHub Actions token | ||
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # For authentication with SSH deploy key | ||
GKSwstype: "100" # for Plots.jl plots (if you have them) | ||
JULIA_DEBUG: "Documenter" | ||
DATADEPS_ALWAYS_ACCEPT: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,6 @@ docs/site | |
|
||
scripts | ||
test_ext | ||
|
||
package-lock.json | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[deps] | ||
Boltz = "4544d5e4-abc5-4dea-817f-29e4c205d9c8" | ||
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" | ||
DocumenterVitepress = "4710194d-e776-4893-9690-8d956a29c365" | ||
Lux = "b2108857-7c20-44ae-9111-449ecde12c47" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using Documenter, DocumenterVitepress, Boltz | ||
|
||
#! format: off | ||
pages = [ | ||
"Boltz.jl" => "index.md", | ||
"Tutorials" => [ | ||
"Getting Started" => "tutorials/getting_started.md", | ||
], | ||
"API Reference" => [ | ||
"Index" => "api/index.md", | ||
"Basis Functions" => "api/basis.md", | ||
"Layers" => "api/layers.md", | ||
"Vision Models" => "api/vision.md", | ||
"Private API" => "api/private.md", | ||
] | ||
] | ||
#! format: on | ||
|
||
deploy_config = Documenter.auto_detect_deploy_system() | ||
deploy_decision = Documenter.deploy_folder(deploy_config; repo="github.com/LuxDL/Boltz.jl", | ||
devbranch="main", devurl="dev", push_preview=true) | ||
|
||
makedocs(; sitename="Boltz.jl Docs", | ||
authors="Avik Pal et al.", | ||
clean=true, | ||
doctest=false, # We test it in the CI, no need to run it here | ||
modules=[Boltz], | ||
linkcheck=true, | ||
repo="https://github.com/LuxDL/Boltz.jl/blob/{commit}{path}#{line}", | ||
format=DocumenterVitepress.MarkdownVitepress(; | ||
repo="github.com/LuxDL/Boltz.jl", devbranch="main", devurl="dev", deploy_decision), | ||
draft=false, | ||
pages) | ||
|
||
deploydocs(; repo="github.com/LuxDL/Boltz.jl.git", | ||
push_preview=true, target="build", devbranch="main") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"devDependencies": { | ||
"markdown-it": "^14.1.0", | ||
"markdown-it-mathjax3": "^4.3.2", | ||
"vitepress": "^1.0.2", | ||
"vitepress-plugin-tabs": "^0.5.0", | ||
"vitest": "^1.3.0" | ||
}, | ||
"scripts": { | ||
"docs:dev": "vitepress dev build/.documenter", | ||
"docs:build": "vitepress build build/.documenter", | ||
"docs:preview": "vitepress preview build/.documenter" | ||
}, | ||
"dependencies": { | ||
"@shikijs/transformers": "^1.1.7", | ||
"markdown-it-footnote": "^4.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import { defineConfig } from 'vitepress' | ||
import { tabsMarkdownPlugin } from 'vitepress-plugin-tabs' | ||
import mathjax3 from "markdown-it-mathjax3"; | ||
import footnote from "markdown-it-footnote"; | ||
import { transformerMetaWordHighlight } from '@shikijs/transformers'; | ||
|
||
// https://vitepress.dev/reference/site-config | ||
export default defineConfig({ | ||
base: 'REPLACE_ME_DOCUMENTER_VITEPRESS',// TODO: replace this in makedocs! | ||
title: 'REPLACE_ME_DOCUMENTER_VITEPRESS', | ||
description: 'Documentation for Boltz.jl', | ||
cleanUrls: true, | ||
outDir: 'REPLACE_ME_DOCUMENTER_VITEPRESS', // This is required for MarkdownVitepress to work correctly... | ||
|
||
markdown: { | ||
math: true, | ||
config(md) { | ||
md.use(tabsMarkdownPlugin), | ||
md.use(mathjax3), | ||
md.use(footnote) | ||
}, | ||
theme: { | ||
light: "github-light", | ||
dark: "github-dark" | ||
}, | ||
codeTransformers: [transformerMetaWordHighlight(),], | ||
}, | ||
|
||
head: [ | ||
[ | ||
"script", | ||
{ async: "", src: "https://www.googletagmanager.com/gtag/js?id=G-Q8GYTEVTZ2" }, | ||
], | ||
[ | ||
"script", | ||
{}, | ||
`window.dataLayer = window.dataLayer || []; | ||
function gtag(){dataLayer.push(arguments);} | ||
gtag('js', new Date()); | ||
gtag('config', 'G-Q8GYTEVTZ2');`, | ||
], | ||
['link', { rel: 'apple-touch-icon', sizes: '180x180', href: '/apple-touch-icon.png' }], | ||
['link', { rel: 'icon', type: 'image/png', sizes: '32x32', href: '/favicon-32x32.png' }], | ||
['link', { rel: 'icon', type: 'image/png', sizes: '16x16', href: '/favicon-16x16.png' }], | ||
['link', { rel: 'icon', href: '/favicon.ico' }], | ||
['link', { rel: 'manifest', href: '/site.webmanifest' }], | ||
], | ||
|
||
themeConfig: { | ||
outline: 'deep', | ||
// https://vitepress.dev/reference/default-theme-config | ||
logo: { | ||
'light': '/lux-logo.svg', | ||
'dark': '/lux-logo-dark.svg' | ||
}, | ||
search: { | ||
provider: 'local', | ||
options: { | ||
detailedView: true | ||
} | ||
}, | ||
nav: 'REPLACE_ME_DOCUMENTER_VITEPRESS', | ||
sidebar: 'REPLACE_ME_DOCUMENTER_VITEPRESS', | ||
editLink: { | ||
pattern: 'https://github.com/LuxDL/Boltz.jl/edit/main/docs/src/:path', | ||
text: 'Edit this page on GitHub' | ||
}, | ||
socialLinks: [ | ||
{ icon: 'github', link: 'REPLACE_ME_DOCUMENTER_VITEPRESS' }, | ||
{ icon: 'twitter', link: 'https://twitter.com/avikpal1410' }, | ||
{ icon: 'slack', link: 'https://julialang.org/slack/' } | ||
], | ||
footer: { | ||
message: 'Made with <a href="https://documenter.juliadocs.org/stable/" target="_blank"><strong>Documenter.jl</strong></a>, <a href="https://vitepress.dev" target="_blank"><strong>VitePress</strong></a> and <a href="https://luxdl.github.io/DocumenterVitepress.jl/stable" target="_blank"><strong>DocumenterVitepress.jl</strong></a><br>Released under the MIT License. Powered by the <a href="https://www.julialang.org">Julia Programming Language</a>.<br>', | ||
copyright: `© Copyright ${new Date().getUTCFullYear()} Avik Pal.` | ||
}, | ||
lastUpdated: { | ||
text: 'Updated at', | ||
formatOptions: { | ||
dateStyle: 'full', | ||
timeStyle: 'medium' | ||
} | ||
}, | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// .vitepress/theme/index.ts | ||
import { h } from 'vue' | ||
import type { Theme } from 'vitepress' | ||
import DefaultTheme from 'vitepress/theme' | ||
import AsideTrustees from '../../components/AsideTrustees.vue' | ||
|
||
import { enhanceAppWithTabs } from 'vitepress-plugin-tabs/client' | ||
import './style.css' | ||
|
||
export default { | ||
extends: DefaultTheme, | ||
Layout() { | ||
return h(DefaultTheme.Layout, null, { | ||
'aside-ads-before': () => h(AsideTrustees), | ||
}) | ||
}, | ||
enhanceApp({ app }) { | ||
enhanceAppWithTabs(app) | ||
} | ||
} satisfies Theme |
Oops, something went wrong.