Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# https://github.com/github-linguist/linguist/blob/master/docs/overrides.md#documentation
examples/* -linguist-documentation
examples/* -linguist-documentation
46 changes: 24 additions & 22 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,57 @@
name: Pages
name: Github Pages

on:
workflow_dispatch:
push:
branches:
- main
branches: ["zine", "main"]
pull_request:
workflow_dispatch:

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

defaults:
run:
shell: bash

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true


jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
fetch-depth: 0 # Change if you need git info
- name: Setup Zine
uses: kristoff-it/setup-zine@v1
with:
mdbook-version: "latest"
- name: Cache Cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/bin
key: pages-${{ runner.os }}
- run: |
if ! command -v mdbook-last-changed; then
cargo install mdbook-last-changed
fi
mdbook build
version: v0.10.2

- name: Build
run: zine release

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./book
path: "public"


deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
if: github.event_name != 'pull_request'
steps:
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
uses: actions/deploy-pages@v4
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
book
public/
zig-out/
zig-cache/
.zig-cache/
.DS_Store
.tool-versions
.vscode
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ endif

.PHONY: serve
serve:
mdbook serve
zine

.PHONY: lint
lint:
npx [email protected] --write book-src
npx [email protected] --write src

.PHONY: run
run:
Expand All @@ -35,5 +35,5 @@ EXCLUDE = --exclude "*webp" --exclude "*svg" --exclude "*gif"

.PHONY: webp
webp:
fd -t f $(EXCLUDE) --full-path './book-src/images' --exec convert {} {.}.webp \;
fd -t f $(EXCLUDE) --full-path './book-src/images' --exec rm {} \;
fd -t f $(EXCLUDE) --full-path './assets/images' --exec convert {} {.}.webp \;
fd -t f $(EXCLUDE) --full-path './assets/images' --exec rm {} \;
2 changes: 1 addition & 1 deletion static/giscus.js → assets/giscus.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ function appendGiscusScript() {
pageDiv.appendChild(script);
}

document.addEventListener('DOMContentLoaded', appendGiscusScript);
document.addEventListener('DOMContentLoaded', appendGiscusScript);
103 changes: 103 additions & 0 deletions assets/highlight.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
:root {
--code-fg: #BD976A;
--keyword: #4D9375;
--variable: #BD976A;
--comment: #758575DD;
--operator: #666666;
--string: #C98A7D;
--number: #4C9A91;
--function: #CB7676;
--bracket: #93aa9e;
}

code {
color: var(--code-fg);
}

code.zig, code.javascript, code.c, code.cpp, code.zon, code.go{
color: var(--code-fg);
.keyword, .keyword_modifier, .type_builtin, .keyword_type, .keyword_return, .keyword_conditional, .keyword_repeat, .keyword_operator, .constant_builtin, .keyword_exception, .type{
color: var(--keyword);
}
.variable, .function_builtin{
color: var(--variable);
}
.comment{
color: var(--comment);
}
.operator, .punctuation{
color: var(--operator);
}
.string, .character{
color: var(--string);
}
.number{
color: var(--number);
}
.keyword_function, .punctuation_delimiter, .function{
color: var(--function);
}
.punctuation_bracket{
color: var(--bracket);
}
}

code.conf{
color: var(--code-fg);
.function{
color: var(--function);
}
.punctuation_bracket{
color: var(--bracket);
}
}

code.diff{
color: var(--code-fg);
.addition, .string{
color: #4D9375;
}
.deletion, .keyword{
color: #CB7676;
}
}

/* TODO 分词器太烂了 */
code.bash {
color: var(--code-fg);
.comment {
color: var(--comment);
font-style: italic;
}
span.operator {
color: var(--operator);
}
.constant {
color: var(--number);
}
.string {
color: var(--string);
}
.function {
color: var(--function);
}
}

code.json{
color: var(--code-fg);
.constant_builtin{
color: var(--keyword);
}
span.string_special_key{
color: var(--string)
}
.string{
color: var(--function)
}
}

@media (prefers-color-scheme: light) {
code{
filter: brightness(0.8) contrast(1.5);
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading
Loading