-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert Documentation to Vitepress #287
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ | |
*.jl.cov | ||
*.jl.mem | ||
Manifest.toml | ||
docs/build/ | ||
|
||
.vscode | ||
*.json | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
build/ | ||
node_modules/ | ||
package-lock.json | ||
Manifest.toml |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
|
||
using QuantumToolbox | ||
using Documenter | ||
using DocumenterVitepress | ||
using DocumenterCitations | ||
|
||
DocMeta.setdocmeta!(QuantumToolbox, :DocTestSetup, :(using QuantumToolbox); recursive = true) | ||
|
@@ -11,16 +12,16 @@ const DRAFT = false # set `true` to disable cell evaluation | |
|
||
bib = CitationBibliography(joinpath(@__DIR__, "src", "bibliography.bib"), style=:authoryear) | ||
|
||
const MathEngine = MathJax3( | ||
Dict( | ||
:loader => Dict("load" => ["[tex]/physics"]), | ||
:tex => Dict( | ||
"inlineMath" => [["\$", "\$"], ["\\(", "\\)"]], | ||
"tags" => "ams", | ||
"packages" => ["base", "ams", "autoload", "physics"], | ||
), | ||
) | ||
) | ||
# const MathEngine = MathJax3( | ||
# Dict( | ||
# :loader => Dict("load" => ["[tex]/physics"]), | ||
# :tex => Dict( | ||
# "inlineMath" => [["\$", "\$"], ["\\(", "\\)"]], | ||
# "tags" => "ams", | ||
# "packages" => ["base", "ams", "autoload", "physics"], | ||
# ), | ||
# ) | ||
# ) | ||
|
||
const PAGES = [ | ||
"Getting Started" => [ | ||
|
@@ -71,16 +72,28 @@ makedocs(; | |
repo = Remotes.GitHub("qutip", "QuantumToolbox.jl"), | ||
sitename = "QuantumToolbox.jl", | ||
pages = PAGES, | ||
format = Documenter.HTML(; | ||
prettyurls = get(ENV, "CI", "false") == "true", | ||
canonical = "https://qutip.github.io/QuantumToolbox.jl", | ||
edit_link = "main", | ||
assets = ["assets/favicon.ico"], | ||
mathengine = MathEngine, | ||
size_threshold_ignore = ["api.md"], | ||
# format = Documenter.HTML(; | ||
# prettyurls = get(ENV, "CI", "false") == "true", | ||
# canonical = "https://qutip.github.io/QuantumToolbox.jl", | ||
# edit_link = "main", | ||
# assets = ["assets/favicon.ico"], | ||
# mathengine = MathEngine, | ||
# size_threshold_ignore = ["api.md"], | ||
# ), | ||
format = DocumenterVitepress.MarkdownVitepress( | ||
repo = "https://qutip.github.io/QuantumToolbox.jl", | ||
# deploy_url = "https://qutip.org/QuantumToolbox.jl/", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we need to uncomment this one There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I'm unsure. But using Documenter.jl, we didn't specify the deploy_url, everything was pushing to GitHub, like here. So, I think that the link is done in some other place |
||
), | ||
draft = DRAFT, | ||
plugins = [bib], | ||
) | ||
|
||
deploydocs(; repo = "github.com/qutip/QuantumToolbox.jl", devbranch = "main") | ||
# deploydocs(; repo = "github.com/qutip/QuantumToolbox.jl", devbranch = "main") | ||
|
||
deploydocs(; | ||
repo = "github.com/qutip/QuantumToolbox.jl", | ||
target = "build", # this is where Vitepress stores its output | ||
devbranch = "main", | ||
branch = "gh-pages", | ||
push_preview = true, | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { defineConfig } from 'vitepress' | ||
import { tabsMarkdownPlugin } from 'vitepress-plugin-tabs' | ||
import mathjax3 from "markdown-it-mathjax3"; | ||
import footnote from "markdown-it-footnote"; | ||
|
||
// 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: 'REPLACE_ME_DOCUMENTER_VITEPRESS', | ||
lastUpdated: true, | ||
cleanUrls: true, | ||
outDir: 'REPLACE_ME_DOCUMENTER_VITEPRESS', // This is required for MarkdownVitepress to work correctly... | ||
head: [['link', { rel: 'icon', href: 'REPLACE_ME_DOCUMENTER_VITEPRESS_FAVICON' }]], | ||
ignoreDeadLinks: true, | ||
|
||
markdown: { | ||
math: true, | ||
config(md) { | ||
md.use(tabsMarkdownPlugin), | ||
md.use(mathjax3), | ||
md.use(footnote) | ||
}, | ||
theme: { | ||
light: "github-light", | ||
dark: "github-dark" | ||
} | ||
}, | ||
themeConfig: { | ||
outline: 'deep', | ||
logo: 'REPLACE_ME_DOCUMENTER_VITEPRESS', | ||
search: { | ||
provider: 'local', | ||
options: { | ||
detailedView: true | ||
} | ||
}, | ||
nav: 'REPLACE_ME_DOCUMENTER_VITEPRESS', | ||
sidebar: 'REPLACE_ME_DOCUMENTER_VITEPRESS', | ||
editLink: 'REPLACE_ME_DOCUMENTER_VITEPRESS', | ||
socialLinks: [ | ||
{ icon: 'github', link: 'REPLACE_ME_DOCUMENTER_VITEPRESS' } | ||
], | ||
footer: { | ||
message: 'Made with <a href="https://luxdl.github.io/DocumenterVitepress.jl/dev/" target="_blank"><strong>DocumenterVitepress.jl</strong></a><br>', | ||
copyright: `© Copyright ${new Date().getUTCFullYear()}.` | ||
} | ||
} | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// .vitepress/theme/index.ts | ||
import { h } from 'vue' | ||
import type { Theme } from 'vitepress' | ||
import DefaultTheme from 'vitepress/theme' | ||
|
||
import { enhanceAppWithTabs } from 'vitepress-plugin-tabs/client' | ||
import './style.css' | ||
|
||
export default { | ||
extends: DefaultTheme, | ||
Layout() { | ||
return h(DefaultTheme.Layout, null, { | ||
// https://vitepress.dev/guide/extending-default-theme#layout-slots | ||
}) | ||
}, | ||
enhanceApp({ app, router, siteData }) { | ||
enhanceAppWithTabs(app) | ||
} | ||
} satisfies Theme |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we don't need to change this part. Better to rebase it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They said to copy their yaml file. I think that the only difference is the doctest (which we are not doing) and some env variables, right?