Skip to content

Commit d2f8678

Browse files
committed
Replace mkdocs with mdbook
1 parent 1b5ef06 commit d2f8678

38 files changed

+4832
-436
lines changed

.github/workflows/book.yml

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,21 @@ on:
66
- 'book/**'
77
workflow_dispatch:
88

9-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
109
permissions:
11-
contents: read
12-
pages: write
13-
id-token: write
14-
15-
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
16-
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
17-
concurrency:
18-
group: "pages"
19-
cancel-in-progress: false
10+
contents: write
11+
actions: read
2012

2113
jobs:
2214
deploy:
2315
name: Deploy book
2416
if: github.ref == 'refs/heads/master'
25-
environment:
26-
name: github-pages
27-
url: ${{ steps.deployment.outputs.page_url }}
2817
runs-on: ubuntu-latest
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.ref }}
2920
steps:
3021
- name: Checkout
3122
uses: actions/checkout@v3
3223

33-
- name: Set Up Python
34-
uses: actions/setup-python@v4
35-
with:
36-
python-version: '3.12'
37-
3824
- name: Init
3925
run: cd book && make init
4026

@@ -44,11 +30,9 @@ jobs:
4430
- name: Setup Pages
4531
uses: actions/configure-pages@v4
4632

47-
- name: Upload artifact
48-
uses: actions/upload-pages-artifact@v2
33+
- name: Deploy
34+
uses: peaceiris/actions-gh-pages@v3
35+
if: ${{ github.ref == 'refs/heads/master' }}
4936
with:
50-
path: './book/site'
51-
52-
- name: Deploy to GitHub Pages
53-
id: deployment
54-
uses: actions/deploy-pages@v3
37+
github_token: ${{ secrets.GITHUB_TOKEN }}
38+
publish_dir: ./book/book

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
members = [
33
"bindings/*",
44
"crates/*",
5-
"crates/nostr-database/fuzz/perf"
5+
"crates/nostr-database/fuzz/perf",
6+
"book/snippets/nostr/rust",
67
]
78
default-members = ["crates/*"]
89
resolver = "2"

book/.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
site/
2-
poetry.lock
1+
book

book/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
init:
2-
pip install -U poetry
3-
poetry install
2+
cargo install mdbook --version 0.4.36
3+
cargo install mdbook-admonish --version 1.15.0
44

55
build:
6-
poetry run mkdocs build --strict --clean --verbose
6+
mdbook build
77

88
serve:
9-
mkdocs serve
9+
mdbook serve

book/book.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[book]
2+
title = "Rust Nostr Book"
3+
description = ""
4+
authors = ["Yuki Kishimoto <[email protected]>", "Rust Nostr Developers"]
5+
language = "en"
6+
multilingual = false
7+
src = "src"
8+
9+
[output.html]
10+
additional-js = ["./tabs.js"]
11+
additional-css = ["./mdbook-admonish.css"]
12+
git-repository-url = "https://github.com/rust-nostr/nostr"
13+
edit-url-template = "https://github.com/rust-nostr/nostr/edit/master/{path}"
14+
15+
[preprocessor]
16+
17+
[preprocessor.admonish]
18+
command = "mdbook-admonish"
19+
assets_version = "3.0.2" # do not edit: managed by `mdbook-admonish install`
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<custom-tabs category="lang">
2+
3+
<div slot="title">Rust</div>
4+
<section>
5+
6+
TODO
7+
8+
</section>
9+
10+
<div slot="title">Python</div>
11+
<section>
12+
13+
TODO
14+
15+
</section>
16+
17+
<div slot="title">JavaScript</div>
18+
<section>
19+
20+
TODO
21+
22+
</section>
23+
24+
<div slot="title">Kotlin</div>
25+
<section>
26+
27+
TODO
28+
29+
</section>
30+
31+
<div slot="title">Swift</div>
32+
<section>
33+
34+
TODO
35+
36+
</section>
37+
</custom-tabs>

book/justfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
test:
2+
cd snippets && just test

0 commit comments

Comments
 (0)