Skip to content

Commit 1a17c06

Browse files
authored
refactor: migrating to zine (#106)
Close #96 Breaking changes: 1. use smd syntax instead of mdbook 2. new layout system 3. new UI/UX ( works well on mobile phone )
1 parent 7b4d4f2 commit 1a17c06

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+976
-435
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# https://github.com/github-linguist/linguist/blob/master/docs/overrides.md#documentation
2-
examples/* -linguist-documentation
2+
examples/* -linguist-documentation

.github/workflows/pages.yml

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,57 @@
1-
name: Pages
1+
name: Github Pages
22

33
on:
4-
workflow_dispatch:
54
push:
6-
branches:
7-
- main
5+
branches: ["zine", "main"]
6+
pull_request:
7+
workflow_dispatch:
88

9+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
910
permissions:
1011
contents: read
1112
pages: write
1213
id-token: write
1314

15+
defaults:
16+
run:
17+
shell: bash
18+
19+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
1420
concurrency:
1521
group: ${{ github.workflow }}-${{ github.ref }}
1622
cancel-in-progress: true
1723

18-
1924
jobs:
2025
build:
2126
runs-on: ubuntu-latest
2227
steps:
2328
- uses: actions/checkout@v4
2429
with:
25-
fetch-depth: 0
26-
- name: Setup mdBook
27-
uses: peaceiris/actions-mdbook@v1
30+
fetch-depth: 0 # Change if you need git info
31+
- name: Setup Zine
32+
uses: kristoff-it/setup-zine@v1
2833
with:
29-
mdbook-version: "latest"
30-
- name: Cache Cargo
31-
uses: actions/cache@v3
32-
with:
33-
path: |
34-
~/.cargo/bin
35-
key: pages-${{ runner.os }}
36-
- run: |
37-
if ! command -v mdbook-last-changed; then
38-
cargo install mdbook-last-changed
39-
fi
40-
mdbook build
34+
version: v0.10.2
35+
36+
- name: Build
37+
run: zine release
38+
4139
- name: Upload artifact
4240
uses: actions/upload-pages-artifact@v3
4341
with:
44-
path: ./book
42+
path: "public"
43+
4544

4645
deploy:
4746
environment:
4847
name: github-pages
4948
url: ${{ steps.deployment.outputs.page_url }}
5049
runs-on: ubuntu-latest
5150
needs: build
51+
if: github.event_name != 'pull_request'
5252
steps:
53+
- name: Setup Pages
54+
uses: actions/configure-pages@v5
5355
- name: Deploy to GitHub Pages
5456
id: deployment
55-
uses: actions/deploy-pages@v4
57+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
book
1+
public/
22
zig-out/
33
zig-cache/
44
.zig-cache/
55
.DS_Store
66
.tool-versions
7+
.vscode

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ endif
66

77
.PHONY: serve
88
serve:
9-
mdbook serve
9+
zine
1010

1111
.PHONY: lint
1212
lint:
13-
npx [email protected] --write book-src
13+
npx [email protected] --write src
1414

1515
.PHONY: run
1616
run:
@@ -35,5 +35,5 @@ EXCLUDE = --exclude "*webp" --exclude "*svg" --exclude "*gif"
3535

3636
.PHONY: webp
3737
webp:
38-
fd -t f $(EXCLUDE) --full-path './book-src/images' --exec convert {} {.}.webp \;
39-
fd -t f $(EXCLUDE) --full-path './book-src/images' --exec rm {} \;
38+
fd -t f $(EXCLUDE) --full-path './assets/images' --exec convert {} {.}.webp \;
39+
fd -t f $(EXCLUDE) --full-path './assets/images' --exec rm {} \;

static/giscus.js renamed to assets/giscus.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ function appendGiscusScript() {
3232
pageDiv.appendChild(script);
3333
}
3434

35-
document.addEventListener('DOMContentLoaded', appendGiscusScript);
35+
document.addEventListener('DOMContentLoaded', appendGiscusScript);

assets/highlight.css

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
:root {
2+
--code-fg: #BD976A;
3+
--keyword: #4D9375;
4+
--variable: #BD976A;
5+
--comment: #758575DD;
6+
--operator: #666666;
7+
--string: #C98A7D;
8+
--number: #4C9A91;
9+
--function: #CB7676;
10+
--bracket: #93aa9e;
11+
}
12+
13+
code {
14+
color: var(--code-fg);
15+
}
16+
17+
code.zig, code.javascript, code.c, code.cpp, code.zon, code.go{
18+
color: var(--code-fg);
19+
.keyword, .keyword_modifier, .type_builtin, .keyword_type, .keyword_return, .keyword_conditional, .keyword_repeat, .keyword_operator, .constant_builtin, .keyword_exception, .type{
20+
color: var(--keyword);
21+
}
22+
.variable, .function_builtin{
23+
color: var(--variable);
24+
}
25+
.comment{
26+
color: var(--comment);
27+
}
28+
.operator, .punctuation{
29+
color: var(--operator);
30+
}
31+
.string, .character{
32+
color: var(--string);
33+
}
34+
.number{
35+
color: var(--number);
36+
}
37+
.keyword_function, .punctuation_delimiter, .function{
38+
color: var(--function);
39+
}
40+
.punctuation_bracket{
41+
color: var(--bracket);
42+
}
43+
}
44+
45+
code.conf{
46+
color: var(--code-fg);
47+
.function{
48+
color: var(--function);
49+
}
50+
.punctuation_bracket{
51+
color: var(--bracket);
52+
}
53+
}
54+
55+
code.diff{
56+
color: var(--code-fg);
57+
.addition, .string{
58+
color: #4D9375;
59+
}
60+
.deletion, .keyword{
61+
color: #CB7676;
62+
}
63+
}
64+
65+
/* TODO 分词器太烂了 */
66+
code.bash {
67+
color: var(--code-fg);
68+
.comment {
69+
color: var(--comment);
70+
font-style: italic;
71+
}
72+
span.operator {
73+
color: var(--operator);
74+
}
75+
.constant {
76+
color: var(--number);
77+
}
78+
.string {
79+
color: var(--string);
80+
}
81+
.function {
82+
color: var(--function);
83+
}
84+
}
85+
86+
code.json{
87+
color: var(--code-fg);
88+
.constant_builtin{
89+
color: var(--keyword);
90+
}
91+
span.string_special_key{
92+
color: var(--string)
93+
}
94+
.string{
95+
color: var(--function)
96+
}
97+
}
98+
99+
@media (prefers-color-scheme: light) {
100+
code{
101+
filter: brightness(0.8) contrast(1.5);
102+
}
103+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)