Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
BlastWind authored Dec 22, 2024
0 parents commit 1452122
Show file tree
Hide file tree
Showing 14 changed files with 1,561 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Mdbook build

on:
push:
branches: ["main"]

jobs:
build:
name: build
runs-on: ubuntu-latest
env:
MDBOOK_VERSION: '0.4.12'
MDBOOK_LINKCHECK_VERSION: '0.7.4'
MDBOOK_MERMAID_VERSION: '0.8.3'
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Install mdbook
run: |
mkdir ~/tools
curl -L https://github.com/rust-lang/mdBook/releases/download/v$MDBOOK_VERSION/mdbook-v$MDBOOK_VERSION-x86_64-unknown-linux-gnu.tar.gz | tar xz -C ~/tools
curl -L https://github.com/badboy/mdbook-mermaid/releases/download/v$MDBOOK_MERMAID_VERSION/mdbook-mermaid-v$MDBOOK_MERMAID_VERSION-x86_64-unknown-linux-gnu.tar.gz | tar xz -C ~/tools
curl -L https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases/download/v$MDBOOK_LINKCHECK_VERSION/mdbook-linkcheck.v$MDBOOK_LINKCHECK_VERSION.x86_64-unknown-linux-gnu.zip -O
unzip mdbook-linkcheck.v$MDBOOK_LINKCHECK_VERSION.x86_64-unknown-linux-gnu.zip -d ~/tools
chmod +x ~/tools/mdbook-linkcheck
curl -s https://api.github.com/repos/zjp-CN/mdbook-theme/releases/latest \
| grep browser_download_url \
| grep mdbook-theme_linux \
| cut -d '"' -f 4 \
| wget -qi -
tar -xzf mdbook-theme_linux.tar.gz -C ~/tools
echo ~/tools >> $GITHUB_PATH
- name: Build
run: mdbook build
# share between different jobs
- uses: actions/upload-artifact@v3
with:
name: book
path: book/
50 changes: 50 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
workflow_run:
workflows: ["Mdbook build"]
types:
- completed

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Disallow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
# actions/download-artifact@v3 does not allow sharing across workflows
- name: Download artifact
id: download-artifact
uses: dawidd6/action-download-artifact@v2
with:
name: book
path: book/
workflow: build.yml
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: book
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
book
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 ZJPzjp

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# mdbook-template

Yield a mdbook demo with [mdbook-theme](https://github.com/zjp-CN/mdbook-theme)
and a yml file for github action automation and page publication.

You just need to creat md files in `src/` dir, then add the filenames in `SUMMARY.md`,
and everything is ready to go.

But for the first time after pushing to github, set the source of github page to
`gh-pages` branch and `/(root)` in `Settings`.

Have fun with mdbook!

30 changes: 30 additions & 0 deletions book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[book]
authors = ["zjp <[email protected]>"]
language = "zh"
multilingual = false
src = "src"
title = "book-name"

[preprocessor.theme]
pagetoc = true
sidebar-width = "250px"

[output.html]
default-theme = "ayu"
git-repository-url = ""
additional-css = ["theme/pagetoc.css"]
additional-js = ["theme/pagetoc.js"]

[output.html.fold]
enable = false
level = 1

[output.html.playground]
editable = true

[output.html.print]
enable = false

[output.theme-ace]
theme-white = "xcode"
theme-dark = "monokai"
3 changes: 3 additions & 0 deletions src/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Summary

- [Chapter 1](./chapter_1.md)
35 changes: 35 additions & 0 deletions src/chapter_1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Chapter 1

## Section 1

## Section 2

# Chapter 2

## Section 1

## Section 2

# Chapter 3

## Section 1

## Section 2

# Chapter 4

## Section 1

## Section 2

# Chapter 5

## Section 1

## Section 2

# Chapter 6

## Section 1

## Section 2
Loading

0 comments on commit 1452122

Please sign in to comment.