diff --git a/.github/workflows/dev-build.yml b/.github/workflows/dev-build.yml index 3611445..5a5390f 100644 --- a/.github/workflows/dev-build.yml +++ b/.github/workflows/dev-build.yml @@ -1,14 +1,11 @@ name: Dev Build on: - push: - branches: - - dev** pull_request: types: [opened, synchronize, reopened] env: - DART_SASS_VERSION: 1.79.6 + DART_SASS_VERSION: 1.81.0 jobs: compile: @@ -25,10 +22,12 @@ jobs: extract: true - name: Add Binary to PATH run: | + ln -s "$GITHUB_WORKSPACE/dart-sass/sass" "$GITHUB_WORKSPACE/dart-sass/dart-sass" echo "$GITHUB_WORKSPACE/dart-sass" >> "$GITHUB_PATH" - name: Compile run: | - cd ./src; make + cd ./src + make -j3 - name: Upload Artifact uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index feae70e..0da64df 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,7 @@ on: - v* env: - DART_SASS_VERSION: 1.79.6 + DART_SASS_VERSION: 1.81.0 jobs: release: @@ -23,10 +23,12 @@ jobs: extract: true - name: Add Binary to PATH run: | + ln -s "$GITHUB_WORKSPACE/dart-sass/sass" "$GITHUB_WORKSPACE/dart-sass/dart-sass" echo "$GITHUB_WORKSPACE/dart-sass" >> "$GITHUB_PATH" - name: Compile run: | - cd ./src; make all-and-compress + cd ./src + make all-and-compress -j3 - name: Release uses: softprops/action-gh-release@v2 if: startsWith(github.ref, 'refs/tags/') diff --git a/src/Makefile b/src/Makefile index ad25461..0c87623 100644 --- a/src/Makefile +++ b/src/Makefile @@ -19,9 +19,9 @@ define build mkdir -p $(target_dir)/$(1)-$(2) mkdir -p $(target_dir)/$(1)-$(2)/target if [ "$(3)" = "light" ]; then \ - sass --no-source-map --style expanded $(working_dir)/headers/$(1)/$(3).scss $(target_dir)/$(1)-$(2)/target/latex.css; \ + dart-sass --no-source-map --style expanded $(working_dir)/headers/$(1)/$(3).scss $(target_dir)/$(1)-$(2)/target/latex.css; \ else \ - sass --no-source-map --style expanded $(working_dir)/headers/$(1)/$(3).scss $(target_dir)/$(1)-$(2)/target/latex-$(3).css; \ + dart-sass --no-source-map --style expanded $(working_dir)/headers/$(1)/$(3).scss $(target_dir)/$(1)-$(2)/target/latex-$(3).css; \ fi endef @@ -46,19 +46,13 @@ define build-pandoc endef .PHONY: all -all: - make windows - make macos - make linux - make pandoc +all: windows macos linux .PHONY: all-and-compress -all-and-compress: - make all +all-and-compress: all cd $(target_dir)/$(windows)-$(typora); zip -r $(target_dir)/latex-theme-$(windows).zip ./* cd $(target_dir)/$(macos)-$(typora); zip -r $(target_dir)/latex-theme-$(macos).zip ./* cd $(target_dir)/$(linux)-$(typora); zip -r $(target_dir)/latex-theme-$(linux).zip ./* -# cd $(target_dir)/$(pandoc)-$(typora); zip -r $(target_dir)/latex-theme-$(pandoc).zip ./* .PHONY: windows windows: diff --git a/src/headers/linux/dark.scss b/src/headers/linux/dark.scss index edea439..1df58c7 100644 --- a/src/headers/linux/dark.scss +++ b/src/headers/linux/dark.scss @@ -1,4 +1 @@ -$os: "linux"; -$theme: "dark"; - -@import "../../scss/include.scss"; +@use "../../scss/include.scss" with ($os: "linux", $theme: "dark"); diff --git a/src/headers/linux/light.scss b/src/headers/linux/light.scss index 22faec3..ca8b168 100644 --- a/src/headers/linux/light.scss +++ b/src/headers/linux/light.scss @@ -1,4 +1 @@ -$os: "linux"; -$theme: "light"; - -@import "../../scss/include.scss"; +@use "../../scss/include.scss" with ($os: "linux", $theme: "light"); diff --git a/src/headers/macos/dark.scss b/src/headers/macos/dark.scss index 2c103c4..b3730c2 100644 --- a/src/headers/macos/dark.scss +++ b/src/headers/macos/dark.scss @@ -1,4 +1 @@ -$os: "macos"; -$theme: "dark"; - -@import "../../scss/include.scss"; +@use "../../scss/include.scss" with ($os: "macos", $theme: "dark"); diff --git a/src/headers/macos/light.scss b/src/headers/macos/light.scss index b2613eb..2f6b2e4 100644 --- a/src/headers/macos/light.scss +++ b/src/headers/macos/light.scss @@ -1,4 +1 @@ -$os: "macos"; -$theme: "light"; - -@import "../../scss/include.scss"; +@use "../../scss/include.scss" with ($os: "macos", $theme: "light"); diff --git a/src/headers/windows/dark.scss b/src/headers/windows/dark.scss index cbb98c7..1ded830 100644 --- a/src/headers/windows/dark.scss +++ b/src/headers/windows/dark.scss @@ -1,4 +1 @@ -$os: "windows"; -$theme: "dark"; - -@import "../../scss/include.scss"; +@use "../../scss/include.scss" with ($os: "windows", $theme: "dark"); diff --git a/src/headers/windows/light.scss b/src/headers/windows/light.scss index 1d474b6..caa892d 100644 --- a/src/headers/windows/light.scss +++ b/src/headers/windows/light.scss @@ -1,4 +1 @@ -$os: "windows"; -$theme: "light"; - -@import "../../scss/include.scss"; +@use "../../scss/include.scss" with ($os: "windows", $theme: "light"); diff --git a/src/scss/blockquote.scss b/src/scss/blockquote.scss index fbe4e4b..b1cfcb2 100644 --- a/src/scss/blockquote.scss +++ b/src/scss/blockquote.scss @@ -1,3 +1,6 @@ +$os: "" !default; +$theme: "" !default; + /* 一个>的引言仅为两字符缩进,使用>>的引言为传统引言样式,具有左竖线、左缩进 */ blockquote { diff --git a/src/scss/code.scss b/src/scss/code.scss index 558c903..1c23617 100644 --- a/src/scss/code.scss +++ b/src/scss/code.scss @@ -1,3 +1,6 @@ +$os: "" !default; +$theme: "" !default; + /* 行内代码 */ code { font-family: var(--code-font), var(--ui-font), monospace; diff --git a/src/scss/dark.scss b/src/scss/dark.scss index 38a00ba..b2b4a03 100644 --- a/src/scss/dark.scss +++ b/src/scss/dark.scss @@ -1,3 +1,6 @@ +$os: "" !default; +$theme: "" !default; + @if $theme == "dark" { /* 可能的代码高亮样式 .cm-s-inner { diff --git a/src/scss/footnote.scss b/src/scss/footnote.scss index 995dae7..db41b6b 100644 --- a/src/scss/footnote.scss +++ b/src/scss/footnote.scss @@ -1,3 +1,6 @@ +$os: "" !default; +$theme: "" !default; + /* 参考文献(脚注)块 */ .footnotes { font-size: 0.95em; diff --git a/src/scss/heading.scss b/src/scss/heading.scss index 050966d..793c6e1 100644 --- a/src/scss/heading.scss +++ b/src/scss/heading.scss @@ -1,3 +1,6 @@ +$os: "" !default; +$theme: "" !default; + #write { // 标题属性 h1, diff --git a/src/scss/include.scss b/src/scss/include.scss index 897984b..9c7408f 100644 --- a/src/scss/include.scss +++ b/src/scss/include.scss @@ -1,14 +1,17 @@ -@import "./settings.scss"; +$os: "" !default; +$theme: "" !default; -@import "./text.scss"; -@import "./typora.scss"; +@use "./settings.scss" with ($os: $os, $theme: $theme); -@import "./heading.scss"; -@import "./footnote.scss"; -@import "./list.scss"; -@import "./table.scss"; -@import "./blockquote.scss"; -@import "./code.scss"; -@import "./toc.scss"; +@use "./text.scss" with ($os: $os, $theme: $theme); +@use "./typora.scss" with ($os: $os, $theme: $theme); -@import "./dark.scss"; +@use "./heading.scss" with ($os: $os, $theme: $theme); +@use "./footnote.scss" with ($os: $os, $theme: $theme); +@use "./list.scss" with ($os: $os, $theme: $theme); +@use "./table.scss" with ($os: $os, $theme: $theme); +@use "./blockquote.scss" with ($os: $os, $theme: $theme); +@use "./code.scss" with ($os: $os, $theme: $theme); +@use "./toc.scss" with ($os: $os, $theme: $theme); + +@use "./dark.scss" with ($os: $os, $theme: $theme); diff --git a/src/scss/list.scss b/src/scss/list.scss index a2cc17e..76c145a 100644 --- a/src/scss/list.scss +++ b/src/scss/list.scss @@ -1,3 +1,6 @@ +$os: "" !default; +$theme: "" !default; + /* 无序列表 */ #write ul { list-style: disc; diff --git a/src/scss/settings.scss b/src/scss/settings.scss index 42485e7..20d27ea 100644 --- a/src/scss/settings.scss +++ b/src/scss/settings.scss @@ -1,3 +1,6 @@ +$os: "" !default; +$theme: "" !default; + :root { $ui-font: null; $heading-Chinese-font: null; diff --git a/src/scss/table.scss b/src/scss/table.scss index d9466b7..e9acd31 100644 --- a/src/scss/table.scss +++ b/src/scss/table.scss @@ -1,3 +1,6 @@ +$os: "" !default; +$theme: "" !default; + #write { // 三线表 table { diff --git a/src/scss/text.scss b/src/scss/text.scss index 80d335a..548c02b 100644 --- a/src/scss/text.scss +++ b/src/scss/text.scss @@ -1,3 +1,6 @@ +$os: "" !default; +$theme: "" !default; + body { padding: 0 !important; margin: 0 !important; diff --git a/src/scss/toc.scss b/src/scss/toc.scss index 8dc4684..692beba 100644 --- a/src/scss/toc.scss +++ b/src/scss/toc.scss @@ -1,3 +1,6 @@ +$os: "" !default; +$theme: "" !default; + /* 目录 */ .md-toc { font-size: var(--toc-font-size); diff --git a/src/scss/typora.scss b/src/scss/typora.scss index 7a9d3d3..553021a 100644 --- a/src/scss/typora.scss +++ b/src/scss/typora.scss @@ -1,3 +1,6 @@ +$os: "" !default; +$theme: "" !default; + @media screen { #write { padding: var(--set-margin);