Skip to content

Commit 3b4c028

Browse files
authored
Merge pull request #127 from 0xMiden/chore/docusaurus-migration
Migrate docs from mdbook to docusaurus
2 parents b281dea + d0183dd commit 3b4c028

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+21955
-2167
lines changed

.github/workflows/build-docs.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: build-docs
2+
3+
# Limits workflow concurrency to only the latest commit in the PR.
4+
concurrency:
5+
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
6+
cancel-in-progress: true
7+
8+
on:
9+
push:
10+
branches: [main]
11+
paths:
12+
- "docs/**"
13+
- ".github/workflows/build-docs.yml"
14+
pull_request:
15+
types: [opened, reopened, synchronize]
16+
paths:
17+
- "docs/**"
18+
- ".github/workflows/build-docs.yml"
19+
workflow_dispatch:
20+
21+
permissions:
22+
contents: read
23+
24+
jobs:
25+
build-docs:
26+
name: Build Documentation
27+
runs-on: ubuntu-latest
28+
29+
steps:
30+
- name: Checkout repository
31+
uses: actions/checkout@v4
32+
33+
- name: Setup Node.js
34+
uses: actions/setup-node@v4
35+
with:
36+
node-version: "20"
37+
cache: "npm"
38+
cache-dependency-path: docs/package-lock.json
39+
40+
- name: Install dependencies
41+
working-directory: ./docs
42+
run: npm ci
43+
44+
- name: Build documentation
45+
working-directory: ./docs
46+
run: npm run build:dev
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Trigger Aggregator Docs Rebuild
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- "docs/**"
8+
9+
jobs:
10+
notify:
11+
runs-on: ubuntu-latest
12+
13+
permissions:
14+
contents: read
15+
16+
steps:
17+
- name: Send repository_dispatch to aggregator
18+
uses: peter-evans/repository-dispatch@a628c95fd17070f003ea24579a56e6bc89b25766
19+
with:
20+
# PAT (Personal Access Token) that grants permission to trigger the rebuild workflow at the docs repository
21+
token: ${{ secrets.DOCS_REPO_TOKEN }}
22+
repository: ${{ vars.DOCS_AGGREGATOR_REPO }}
23+
event-type: rebuild

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,9 @@ This repository is organized into several parts:
88
2. **masm**, contains the Miden assembly notes, accounts, and scripts used in the examples.
99
3. **rust-client**, contains examples for interacting with the Miden Rollup using **Rust**.
1010
4. **web-client**, contains examples for interacting with the Miden Rollup in the browser.
11+
12+
## Documentation
13+
14+
The documentation (tutorials) in the `docs` folder is built using Docusaurus and is automatically absorbed into the main [miden-docs](https://github.com/0xMiden/miden-docs) repository for the main documentation website. Changes to the `next` branch trigger an automated deployment workflow. The docs folder requires npm packages to be installed before building.
15+
16+
The documentation folder is also a standalone Rust repository. The purpose of this is to be able to run `cargo doc test`, to test the Rust code inside of the tutorial markdowns.

docs/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.docusaurus/
2+
build/
3+
node_modules/

docs/docusaurus.config.ts

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
import type { Config } from "@docusaurus/types";
2+
import { themes as prismThemes } from "prism-react-renderer";
3+
4+
// If your content lives in docs/src, set DOCS_PATH='src'; else '.'
5+
const DOCS_PATH =
6+
process.env.DOCS_PATH || (require("fs").existsSync("src") ? "src" : ".");
7+
8+
const config: Config = {
9+
title: "Docs Dev Preview",
10+
url: "http://localhost:3000",
11+
baseUrl: "/",
12+
trailingSlash: false,
13+
14+
// Minimal classic preset: docs only, autogenerated sidebars, same math plugins as prod
15+
presets: [
16+
[
17+
"classic",
18+
{
19+
docs: {
20+
path: DOCS_PATH, // '../docs' is implied because we are already inside docs/
21+
routeBasePath: "/", // mount docs at root for quick preview
22+
sidebarPath: "./sidebars.ts",
23+
remarkPlugins: [require("remark-math")],
24+
rehypePlugins: [require("rehype-katex")],
25+
versions: {
26+
current: {
27+
label: `stable`,
28+
},
29+
},
30+
},
31+
blog: false,
32+
pages: false,
33+
theme: {
34+
customCss: "./styles.css",
35+
},
36+
},
37+
],
38+
],
39+
40+
plugins: [
41+
[
42+
"@cmfcmf/docusaurus-search-local",
43+
{
44+
// whether to index docs pages
45+
indexDocs: true,
46+
47+
// whether to index blog pages
48+
indexBlog: false,
49+
50+
// whether to index static pages
51+
indexPages: false,
52+
53+
// language of your documentation, see next section
54+
language: "en",
55+
56+
// setting this to "none" will prevent the default CSS to be included. The default CSS
57+
// comes from autocomplete-theme-classic, which you can read more about here:
58+
// https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-theme-classic/
59+
style: undefined,
60+
61+
// lunr.js-specific settings
62+
lunr: {
63+
// When indexing your documents, their content is split into "tokens".
64+
// Text entered into the search box is also tokenized.
65+
// This setting configures the separator used to determine where to split the text into tokens.
66+
// By default, it splits the text at whitespace and dashes.
67+
//
68+
// Note: Does not work for "ja" and "th" languages, since these use a different tokenizer.
69+
tokenizerSeparator: /[\s\-]+/,
70+
// https://lunrjs.com/guides/customising.html#similarity-tuning
71+
//
72+
// This parameter controls the importance given to the length of a document and its fields. This
73+
// value must be between 0 and 1, and by default it has a value of 0.75. Reducing this value
74+
// reduces the effect of different length documents on a term's importance to that document.
75+
b: 0.75,
76+
// This controls how quickly the boost given by a common word reaches saturation. Increasing it
77+
// will slow down the rate of saturation and lower values result in quicker saturation. The
78+
// default value is 1.2. If the collection of documents being indexed have high occurrences
79+
// of words that are not covered by a stop word filter, these words can quickly dominate any
80+
// similarity calculation. In these cases, this value can be reduced to get more balanced results.
81+
k1: 1.2,
82+
// By default, we rank pages where the search term appears in the title higher than pages where
83+
// the search term appears in just the text. This is done by "boosting" title matches with a
84+
// higher value than content matches. The concrete boosting behavior can be controlled by changing
85+
// the following settings.
86+
titleBoost: 5,
87+
contentBoost: 1,
88+
tagsBoost: 3,
89+
parentCategoriesBoost: 2, // Only used when indexing is enabled for categories
90+
},
91+
},
92+
],
93+
],
94+
95+
themeConfig:
96+
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
97+
{
98+
colorMode: {
99+
defaultMode: "light",
100+
disableSwitch: true,
101+
},
102+
prism: {
103+
theme: prismThemes.oneLight,
104+
darkTheme: prismThemes.oneDark,
105+
additionalLanguages: ["rust", "solidity", "toml", "yaml"],
106+
},
107+
navbar: {
108+
logo: {
109+
src: "img/logo.png",
110+
alt: "Miden Logo",
111+
height: 240,
112+
},
113+
title: "MIDEN",
114+
items: [
115+
{
116+
type: "docsVersionDropdown",
117+
position: "left",
118+
dropdownActiveClassDisabled: true,
119+
},
120+
{
121+
href: "https://github.com/0xMiden/",
122+
label: "GitHub",
123+
position: "right",
124+
},
125+
],
126+
},
127+
},
128+
};
129+
export default config;

0 commit comments

Comments
 (0)