Skip to content

Commit cb024f1

Browse files
committed
initial checkin
1 parent 8c0e503 commit cb024f1

File tree

7 files changed

+2699
-0
lines changed

7 files changed

+2699
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Build and Deploy mdBook
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout source repo
14+
uses: actions/checkout@v4
15+
16+
- name: Setup mdBook
17+
uses: peaceiris/actions-mdbook@v2
18+
with:
19+
mdbook-version: 'latest' # Or specify a version, e.g., '0.4.38'
20+
- name: Setup mermaid
21+
run: cargo install mdbook-mermaid --force
22+
23+
- name: Build book
24+
run: mdbook build
25+
26+
- name: Deploy to GitHub Pages repo
27+
uses: peaceiris/actions-gh-pages@v4
28+
with:
29+
personal_token: ${{ secrets.DOCS_DEPLOY_TOKEN }}
30+
external_repository: networknt/networknt.github.io
31+
publish_dir: ./book
32+
publish_branch: master

.gitignore

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

book.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[book]
2+
title = "Light-4j Platform"
3+
authors = ["Steve Hu"]
4+
language = "en"
5+
6+
[preprocessor]
7+
8+
[preprocessor.mermaid]
9+
command = "mdbook-mermaid"
10+
11+
[output]
12+
13+
[output.html]
14+
additional-js = ["mermaid.min.js", "mermaid-init.js"]

mermaid-init.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// This Source Code Form is subject to the terms of the Mozilla Public
2+
// License, v. 2.0. If a copy of the MPL was not distributed with this
3+
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
4+
5+
(() => {
6+
const darkThemes = ['ayu', 'navy', 'coal'];
7+
const lightThemes = ['light', 'rust'];
8+
9+
const classList = document.getElementsByTagName('html')[0].classList;
10+
11+
let lastThemeWasLight = true;
12+
for (const cssClass of classList) {
13+
if (darkThemes.includes(cssClass)) {
14+
lastThemeWasLight = false;
15+
break;
16+
}
17+
}
18+
19+
const theme = lastThemeWasLight ? 'default' : 'dark';
20+
mermaid.initialize({ startOnLoad: true, theme });
21+
22+
// Simplest way to make mermaid re-render the diagrams in the new theme is via refreshing the page
23+
24+
for (const darkTheme of darkThemes) {
25+
document.getElementById(darkTheme).addEventListener('click', () => {
26+
if (lastThemeWasLight) {
27+
window.location.reload();
28+
}
29+
});
30+
}
31+
32+
for (const lightTheme of lightThemes) {
33+
document.getElementById(lightTheme).addEventListener('click', () => {
34+
if (!lastThemeWasLight) {
35+
window.location.reload();
36+
}
37+
});
38+
}
39+
})();

mermaid.min.js

Lines changed: 2609 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/SUMMARY.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Summary
2+
3+
- [Chapter 1](./chapter_1.md)

src/chapter_1.md

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

0 commit comments

Comments
 (0)