Skip to content

Commit 0abb37d

Browse files
committed
get book setup
1 parent 6cf4e4e commit 0abb37d

File tree

6 files changed

+243
-0
lines changed

6 files changed

+243
-0
lines changed

.github/workflows/mdbook.yml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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+
#
5+
name: Deploy mdBook site to Pages
6+
7+
on:
8+
# Runs on pushes targeting the default branch
9+
push:
10+
branches: ["mdbook"]
11+
12+
# Allows you to run this workflow manually from the Actions tab
13+
workflow_dispatch:
14+
15+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
16+
permissions:
17+
contents: read
18+
pages: write
19+
id-token: write
20+
21+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
22+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
23+
concurrency:
24+
group: "pages"
25+
cancel-in-progress: false
26+
27+
jobs:
28+
# Build job
29+
build:
30+
runs-on: ubuntu-latest
31+
env:
32+
MDBOOK_VERSION: 0.4.36
33+
steps:
34+
- uses: actions/checkout@v4
35+
- name: Install mdBook
36+
run: |
37+
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf -y | sh
38+
rustup update
39+
cargo install --version ${MDBOOK_VERSION} mdbook
40+
- name: Setup Pages
41+
id: pages
42+
uses: actions/configure-pages@v4
43+
- name: Build with mdBook
44+
run: mdbook build
45+
- name: Upload artifact
46+
uses: actions/upload-pages-artifact@v3
47+
with:
48+
path: ./book
49+
50+
# Deployment job
51+
deploy:
52+
environment:
53+
name: github-pages
54+
url: ${{ steps.deployment.outputs.page_url }}
55+
runs-on: ubuntu-latest
56+
needs: build
57+
steps:
58+
- name: Deploy to GitHub Pages
59+
id: deployment
60+
uses: actions/deploy-pages@v4

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
book

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Shawn Tabrizi
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

book.toml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[book]
2+
authors = ["Shawn Tabrizi"]
3+
language = "en"
4+
multilingual = false
5+
src = "src"
6+
title = "XCM Workshop"
7+
8+
[output.html]
9+
additional-css = ["custom/styles.css"]
10+
additional-js = ["custom/tabs.js"]
11+
git-repository-url = "https://github.com/shawntabrizi/polkadot-sdk-workshop-xcm"
12+
git-repository-icon = "fa-github"

custom/styles.css

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
:root {
2+
--content-max-width: 100% !important;
3+
}
4+
5+
/* -- Section -- */
6+
7+
.content-section {
8+
max-width: 800px;
9+
margin: auto;
10+
}
11+
12+
/* -- Two Col Layout -- */
13+
14+
.content-row {
15+
display: flex;
16+
flex-wrap: wrap;
17+
}
18+
19+
.content-col {
20+
gap: 10px;
21+
width: 50%;
22+
}
23+
24+
@media screen and (max-width: 768px) {
25+
.content-col {
26+
width: 100%;
27+
}
28+
}
29+
30+
/* -- Tabs -- */
31+
32+
/* Style the tab */
33+
.tab {
34+
overflow: hidden;
35+
border: 1px solid #333;
36+
background-color: #111;
37+
color: #fff;
38+
}
39+
40+
/* Style the buttons that are used to open the tab content */
41+
.tab button {
42+
background-color: inherit;
43+
float: left;
44+
border: none;
45+
outline: none;
46+
cursor: pointer;
47+
padding: 14px 16px;
48+
transition: 0.3s;
49+
}
50+
51+
/* Change background color of buttons on hover */
52+
.tab button:hover {
53+
background-color: #222;
54+
}
55+
56+
/* Create an active/current tablink class */
57+
.tab button.active {
58+
background-color: #333;
59+
}
60+
61+
/* Style the tab content */
62+
.tabcontent {
63+
display: none;
64+
padding: 6px 12px;
65+
border: 1px solid #333;
66+
border-top: none;
67+
}
68+
69+
.tabcontent.active {
70+
display: block !important;
71+
}
72+
73+
.file-modified {
74+
color: darkorange;
75+
}
76+
77+
.file-solution.file-modified {
78+
color: skyblue;
79+
}
80+
81+
.file-added {
82+
color: limegreen;
83+
}

custom/tabs.js

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
function switchMainTab(evt, tabName) {
2+
// Declare all variables
3+
var i, tabcontent, tablinks;
4+
5+
// Get all elements with class="tabcontent" and hide them
6+
tabcontent = document.getElementsByClassName("maintab tabcontent");
7+
for (i = 0; i < tabcontent.length; i++) {
8+
tabcontent[i].className = tabcontent[i].className.replace(" active", "");
9+
}
10+
11+
// Get all elements with class="tablinks" and remove the class "active"
12+
tablinks = document.getElementsByClassName("maintab tablinks");
13+
for (i = 0; i < tablinks.length; i++) {
14+
tablinks[i].className = tablinks[i].className.replace(" active", "");
15+
}
16+
17+
// Show the current tab, and add an "active" class to the button that opened the tab
18+
document.getElementById(tabName).className += " active";
19+
evt.currentTarget.className += " active";
20+
}
21+
22+
function switchSubTab(evt, filePath) {
23+
// Declare all variables
24+
var i, tabcontent, tablinks;
25+
26+
// Get all elements with class="tabcontent" and hide them
27+
tabcontent = document.getElementsByClassName("subtab tabcontent");
28+
for (i = 0; i < tabcontent.length; i++) {
29+
tabcontent[i].className = tabcontent[i].className.replace(" active", "");
30+
}
31+
32+
// Get all elements with class="tablinks" and remove the class "active"
33+
tablinks = document.getElementsByClassName("subtab tablinks");
34+
for (i = 0; i < tablinks.length; i++) {
35+
tablinks[i].className = tablinks[i].className.replace(" active", "");
36+
}
37+
38+
// Get all elements with class matching the tabname class and show them
39+
tabcontent = document.querySelectorAll(`[data-id="${filePath}"]`);
40+
for (i = 0; i < tabcontent.length; i++) {
41+
tabcontent[i].className += " active";
42+
}
43+
}
44+
45+
function switchDiff(evt, filePath) {
46+
// Declare all variables
47+
var i, tabcontent, tablinks;
48+
49+
// Get all elements with class="tabcontent" and hide them
50+
tabcontent = document.getElementsByClassName("difftab tabcontent");
51+
for (i = 0; i < tabcontent.length; i++) {
52+
tabcontent[i].className = tabcontent[i].className.replace(" active", "");
53+
}
54+
55+
// Get all elements with class="tablinks" and remove the class "active"
56+
tablinks = document.getElementsByClassName("difftab tablinks");
57+
for (i = 0; i < tablinks.length; i++) {
58+
tablinks[i].className = tablinks[i].className.replace(" active", "");
59+
}
60+
61+
// Get all elements with class matching the tabname class and show them
62+
tabcontent = document.querySelectorAll(`[data-id="${filePath}"]`);
63+
for (i = 0; i < tabcontent.length; i++) {
64+
tabcontent[i].className += " active";
65+
}
66+
}

0 commit comments

Comments
 (0)