Skip to content

Commit aa118d2

Browse files
authored
Merge pull request #87 from openwallet-foundation-labs/77-consolidate-into-a-developer-guide
Extend mdBook and create GitHub Pages pipeline
2 parents 9e2f41b + e69f341 commit aa118d2

12 files changed

+2943
-49
lines changed

.github/workflows/gh-pages.yml

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Sample workflow for building and deploying a mdBook site to GitHub Pages
2+
#
3+
# To get started with mdBook see: https://rust-lang.github.io/mdBook/index.html
4+
name: Deploy mdBook site to Pages
5+
6+
on:
7+
# Runs on pushes targeting the default branch
8+
push:
9+
branches: [ $default-branch ]
10+
11+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
18+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
19+
concurrency:
20+
group: "pages"
21+
cancel-in-progress: false
22+
23+
jobs:
24+
# Build job
25+
build:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v4
29+
- name: Install Rust
30+
uses: dtolnay/rust-toolchain@stable
31+
- uses: Swatinem/rust-cache@v2
32+
- name: Install mdBook
33+
run: cargo install mdbook
34+
- name: Install mermaid preprocessor
35+
run: cargo install mdbook-mermaid
36+
- name: Setup Pages
37+
id: pages
38+
uses: actions/configure-pages@v5
39+
- name: Build with mdBook
40+
run: mdbook build
41+
working-directory: docs
42+
- name: Upload artifact
43+
uses: actions/upload-pages-artifact@v3
44+
with:
45+
path: ./docs/book
46+
47+
# Deployment job
48+
deploy:
49+
environment:
50+
name: github-pages
51+
url: ${{ steps.deployment.outputs.page_url }}
52+
runs-on: ubuntu-latest
53+
needs: build
54+
steps:
55+
- name: Deploy to GitHub Pages
56+
id: deployment
57+
uses: actions/deploy-pages@v4

docs/book.toml

+12
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,15 @@ language = "en"
44
multilingual = false
55
src = "src"
66
title = "Rust TSP Guides"
7+
8+
[rust]
9+
edition = "2024"
10+
11+
[preprocessor.mermaid]
12+
command = "mdbook-mermaid"
13+
14+
[output.html]
15+
additional-js = ["mermaid.min.js", "mermaid-init.js"]
16+
git-repository-url = "https://github.com/openwallet-foundation-labs/tsp/tree/main/docs"
17+
hash-files = true
18+
cname = "docs.teaspoon.world"

docs/custom-vids.md

-48
This file was deleted.

docs/mermaid-init.js

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
(() => {
2+
const darkThemes = ['ayu', 'navy', 'coal'];
3+
const lightThemes = ['light', 'rust'];
4+
5+
const classList = document.getElementsByTagName('html')[0].classList;
6+
7+
let lastThemeWasLight = true;
8+
for (const cssClass of classList) {
9+
if (darkThemes.includes(cssClass)) {
10+
lastThemeWasLight = false;
11+
break;
12+
}
13+
}
14+
15+
const theme = lastThemeWasLight ? 'default' : 'dark';
16+
mermaid.initialize({ startOnLoad: true, theme });
17+
18+
// Simplest way to make mermaid re-render the diagrams in the new theme is via refreshing the page
19+
20+
for (const darkTheme of darkThemes) {
21+
document.getElementById(darkTheme).addEventListener('click', () => {
22+
if (lastThemeWasLight) {
23+
window.location.reload();
24+
}
25+
});
26+
}
27+
28+
for (const lightTheme of lightThemes) {
29+
document.getElementById(lightTheme).addEventListener('click', () => {
30+
if (!lastThemeWasLight) {
31+
window.location.reload();
32+
}
33+
});
34+
}
35+
})();

docs/mermaid.min.js

+2,186
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/src/SUMMARY.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
# Summary
22

33
- [Getting started](./start.md)
4+
- [TSP technical specification](./TSP-technical-specification.md)
45
- [Web interface](./web-interface.md)
56
- [Command line interface](./cli/index.md)
67
- [Installation](./cli/installation.md)
78
- [Usage](./cli/usage.md)
89
- [Nested mode](./cli/nested.md)
910
- [Routed mode](./cli/routed.md)
11+
- [Benchmark](benchmark.md)
12+
- [Custom VIDs](custom-vids.md)
13+
- [Planning](planning.md)

0 commit comments

Comments
 (0)