Skip to content
Merged
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
7 changes: 3 additions & 4 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
DocumenterVitepress = "4710194d-e776-4893-9690-8d956a29c365"
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
Reactant = "3c362404-f566-11ee-1572-e11a4b42c853"
ReactantCore = "a3311ec8-5e00-46d5-b541-4f83e724a433"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
Documenter = "1.4.1"

[sources]
Reactant = {path = ".."}
ReactantCore = {path = "../lib/ReactantCore"}

[compat]
Documenter = "1.4.1"
54 changes: 0 additions & 54 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,59 +3,6 @@ using Documenter, DocumenterVitepress

DocMeta.setdocmeta!(Reactant, :DocTestSetup, :(using Reactant); recursive=true)

# Helper functions
function first_letter_uppercase(str)
return uppercase(str[1]) * str[2:end]
end

# Generate examples

using Literate

const EXAMPLES_DIR = joinpath(@__DIR__, "..", "examples")
const OUTPUT_DIR = joinpath(@__DIR__, "src/generated")

examples = Pair{String,String}[]

for (_, name) in examples
example_filepath = joinpath(EXAMPLES_DIR, string(name, ".jl"))
Literate.markdown(example_filepath, OUTPUT_DIR; documenter=true)
end

examples = [
title => joinpath("generated", string(name, ".md")) for (title, name) in examples
]

pages = [
"Reactant.jl" => "index.md",
"Introduction" => [
"Getting Started" => "introduction/index.md",
"Configuration" => "introduction/configuration.md",
],
"Tutorials" => [
"Overview" => "tutorials/index.md",
"Profiling" => "tutorials/profiling.md",
"Distributed" => "tutorials/multihost.md",
"Local build" => "tutorials/local-build.md",
],
"API Reference" => [
"Reactant API" => "api/api.md",
"Ops" => "api/ops.md",
"Dialects" => sort!(
[
first_letter_uppercase(first(splitext(basename(file)))) =>
joinpath("api/dialects", file) for
file in readdir(joinpath(@__DIR__, "src/api/dialects")) if
splitext(file)[2] == ".md"
];
by=first,
),
"MLIR API" => "api/mlirc.md",
"XLA" => "api/xla.md",
"Internal API" => "api/internal.md",
],
]

makedocs(;
modules=[
Reactant,
Expand All @@ -82,7 +29,6 @@ makedocs(;
# build_vitepress=false, # Uncomment for local testing
),
# clean=false, # Uncomment for local testing
pages=pages,
doctest=true,
warnonly=[:cross_references],
)
Expand Down
19 changes: 12 additions & 7 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
{
"devDependencies": {
"@nolebase/vitepress-plugin-enhanced-readabilities": "^2.15.0",
"@types/d3-format": "^3.0.4",
"@types/node": "^22.13.9",
"markdown-it": "^14.1.0",
"markdown-it-mathjax3": "^4.3.2",
"vitepress": "^1.6.3",
"vitepress-plugin-tabs": "^0.6.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": "^14.1.0",
"markdown-it-footnote": "^4.0.0",
"markdown-it-mathjax3": "^4.3.2",
"vitepress": "^1.1.4",
"vitepress-plugin-tabs": "^0.5.0"
"d3-format": "^3.1.0",
"markdown-it-footnote": "^4.0.0"
}
}
}
56 changes: 41 additions & 15 deletions docs/src/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { tabsMarkdownPlugin } from "vitepress-plugin-tabs";
import mathjax3 from "markdown-it-mathjax3";
import footnote from "markdown-it-footnote";
import { transformerMetaWordHighlight } from "@shikijs/transformers";
import path from 'path'

const baseTemp = {
base: 'REPLACE_ME_DOCUMENTER_VITEPRESS', // TODO: replace this in makedocs!
Expand All @@ -15,9 +16,35 @@ export default defineConfig({
description: "Documentation for Reactant.jl",
cleanUrls: true,
outDir: 'REPLACE_ME_DOCUMENTER_VITEPRESS', // This is required for MarkdownVitepress to work correctly...

ignoreDeadLinks: true, // tested in Documenter.jl directly

lastUpdated: true,

head: [
['link', { rel: "icon", href: `${baseTemp.base}favicon.ico` }],
['script', {src: `/versions.js` }],
['script', { src: `${baseTemp.base}siteinfo.js` }],
],
vite: {
resolve: {
alias: {
'@': path.resolve(__dirname, '../components')
}
},
optimizeDeps: {
exclude: [
'@nolebase/vitepress-plugin-enhanced-readabilities/client',
'vitepress',
'@nolebase/ui',
],
},
ssr: {
noExternal: [
// If there are other packages that need to be processed by Vite, you can add them here.
'@nolebase/vitepress-plugin-enhanced-readabilities',
'@nolebase/ui',
],
},
},
markdown: {
math: true,
config(md) {
Expand All @@ -30,12 +57,6 @@ export default defineConfig({
codeTransformers: [transformerMetaWordHighlight()],
},

head: [
["link", { rel: "icon", href: "REPLACE_ME_DOCUMENTER_VITEPRESS_FAVICON" }],
["script", { src: `/versions.js` }],
["script", { src: `${baseTemp.base}siteinfo.js` }],
],

themeConfig: {
outline: "deep",
// https://vitepress.dev/reference/default-theme-config
Expand Down Expand Up @@ -110,15 +131,18 @@ export default defineConfig({
},
],
sidebar: {
"/introduction/": {
"/introduction/": [
{
text: "Getting Started",
collapsed: false,
items: [
{ text: "Introduction", link: "/introduction" },
{ text: "Configuration", link: "/introduction/configuration" },
],
},
"/tutorials/": {
}
],
"/tutorials/": [
{
text: "Tutorials",
collapsed: false,
items: [
Expand All @@ -127,8 +151,10 @@ export default defineConfig({
{ text: "Distributed", link: "/tutorials/multihost" },
{ text: "Local build", link: "/tutorials/local-build" },
],
},
"/api/": {
}
],
"/api/": [
{
text: "API Reference",
collapsed: false,
items: [
Expand Down Expand Up @@ -171,14 +197,14 @@ export default defineConfig({
},
{ text: "Internal API", link: "/api/internal" },
],
},
}
],
},
editLink: {
pattern: "https://github.com/EnzymeAD/Reactant.jl/edit/main/docs/src/:path",
text: "Edit this page on GitHub",
},
socialLinks: [
{ icon: "github", link: "https://github.com/EnzymeAD/Reactant.jl" },
{ icon: "slack", link: "https://julialang.org/slack/" },
],
footer: {
Expand Down
34 changes: 27 additions & 7 deletions docs/src/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,42 @@
// .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 VersionPicker from "../../components/VersionPicker.vue";
import type { Theme as ThemeConfig } from 'vitepress'

import {
NolebaseEnhancedReadabilitiesMenu,
NolebaseEnhancedReadabilitiesScreenMenu,
} from '@nolebase/vitepress-plugin-enhanced-readabilities/client'

import AsideTrustees from '@/AsideTrustees.vue'
import VersionPicker from "@/VersionPicker.vue"
import StarUs from '@/StarUs.vue'
import AuthorBadge from '@/AuthorBadge.vue'
import Authors from '@/Authors.vue'
import { enhanceAppWithTabs } from 'vitepress-plugin-tabs/client'
import './style.css'

export default {
import '@nolebase/vitepress-plugin-enhanced-readabilities/client/style.css'
import './style.css' // You could setup your own, or else a default will be copied.
import './docstrings.css' // You could setup your own, or else a default will be copied.

export const Theme: ThemeConfig = {
extends: DefaultTheme,
Layout() {
return h(DefaultTheme.Layout, null, {
'aside-ads-before': () => h(AsideTrustees),
'nav-bar-content-after': () => [
h(StarUs),
h(NolebaseEnhancedReadabilitiesMenu), // Enhanced Readabilities menu
],
// A enhanced readabilities menu for narrower screens (usually smaller than iPad Mini)
'nav-screen-content-after': () => h(NolebaseEnhancedReadabilitiesScreenMenu),
})
},
enhanceApp({ app }) {
enhanceApp({ app, router, siteData }) {
enhanceAppWithTabs(app);
app.component('VersionPicker', VersionPicker);
app.component('AuthorBadge', AuthorBadge)
app.component('Authors', Authors)
}
} satisfies Theme
}
export default Theme
Loading
Loading