Skip to content

Commit d90b151

Browse files
committed
Initial mdbook setup
1 parent 416662a commit d90b151

15 files changed

Lines changed: 754 additions & 0 deletions

File tree

.github/workflows/mdbooks.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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: ["docs"]
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.45
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+
cargo install mdbook-admonish
41+
- name: Setup Pages
42+
id: pages
43+
uses: actions/configure-pages@v5
44+
- name: Build with mdBook
45+
run: mdbook build docs
46+
- name: Upload artifact
47+
uses: actions/upload-pages-artifact@v3
48+
with:
49+
path: ./docs/book
50+
51+
# Deployment job
52+
deploy:
53+
environment:
54+
name: github-pages
55+
url: ${{ steps.deployment.outputs.page_url }}
56+
runs-on: ubuntu-latest
57+
needs: build
58+
steps:
59+
- name: Deploy to GitHub Pages
60+
id: deployment
61+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ _site
1010
*.tgz
1111
.header.json
1212
.simstate.json
13+
.DS_Store

docs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
book

docs/book.toml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[book]
2+
title = "ZHAW Lightbag Workshop"
3+
description = "Musterlösung für den ZHAW Lightbag Workshop"
4+
authors = ["wimd", "ebep"]
5+
6+
language = "de"
7+
multilingual = true
8+
src = "src"
9+
10+
11+
12+
[build]
13+
create-missing = false
14+
15+
[preprocessor]
16+
17+
[preprocessor.admonish]
18+
command = "mdbook-admonish"
19+
assets_version = "3.0.3" # do not edit: managed by `mdbook-admonish install`
20+
21+
[output]
22+
23+
[output.html]
24+
fold.enable = true
25+
default-theme = "rust"
26+
additional-css = ["css/makecode.css", "css/page-aspects.css"]
27+
additional-js = ["js/zoom.js"]

docs/css/makecode.css

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
.codeblock {
2+
max-width: 100%;
3+
height: auto;
4+
object-fit: contain;
5+
cursor: zoom-in; /* Default cursor for zoomable images */
6+
transition: transform 0.3s ease;
7+
transform-origin: center;
8+
touch-action: none; /* Prevents default touch behaviors */
9+
display: block; /* Ensure proper display in MDBook */
10+
margin: 0 auto; /* Center images by default */
11+
}
12+
13+
.codeblock-container {
14+
position: relative;
15+
overflow: visible; /* Allow image to overflow slightly */
16+
margin: 0.5em auto; /* Keep margin on container instead of image */
17+
max-width: 100%;
18+
line-height: 0; /* Remove extra space below image */
19+
transition: height 0.3s ease; /* Smooth transition for height changes */
20+
padding: 2px 0; /* Add small vertical padding to prevent cropping */
21+
text-align: center; /* Center containers by default */
22+
}
23+
24+
.codeblock.zoomed {
25+
position: absolute;
26+
top: 0;
27+
left: 0;
28+
right: 0;
29+
bottom: 0;
30+
margin: 0;
31+
cursor: grab;
32+
transform-origin: center;
33+
transition: none; /* Disable transition for smooth panning */
34+
width: 100%;
35+
height: 100%;
36+
object-fit: contain;
37+
}
38+
39+
/* When an image is zoomed, ensure the container adjusts accordingly */
40+
.codeblock-container:has(.zoomed) {
41+
overflow: hidden; /* Hide overflow only when zoomed */
42+
height: auto !important; /* Override any inline height */
43+
min-height: 600px !important; /* Provide enough space for zoomed content */
44+
}
45+
46+
/* .codeblock:hover {
47+
transform: scale(1.1);
48+
} */
49+
50+
/* Prevent zooming for simple code blocks and align left */
51+
.codeblock.no-zoom {
52+
cursor: default !important;
53+
pointer-events: none !important;
54+
transform: none !important;
55+
transition: none !important;
56+
margin: 0; /* Remove auto margins to allow left alignment */
57+
}
58+
59+
.codeblock-container:has(.no-zoom) {
60+
overflow: hidden;
61+
pointer-events: none;
62+
text-align: left; /* Left align container for non-zoomable images */
63+
margin-left: 0; /* Remove left margin for left alignment */
64+
}
65+

docs/css/page-aspects.css

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
:root {
3+
--content-max-width: 80%;
4+
}
5+
6+
.chapter li.part-title {
7+
color: var(--sidebar-fg);
8+
margin-bottom: -5px;
9+
margin-top: 11px;
10+
font-weight: bold;
11+
}
12+
13+
.chapter li.chapter-item {
14+
line-height: 1.5em;
15+
margin-left: 0.5em;
16+
margin-top: 0.6em;
17+
}

0 commit comments

Comments
 (0)