Skip to content

Commit

Permalink
feat: 支持 EPUB 与 PDF 版
Browse files Browse the repository at this point in the history
  • Loading branch information
Zh40Le1ZOOB committed Jan 17, 2024
1 parent cf2ef86 commit ff75293
Show file tree
Hide file tree
Showing 750 changed files with 1,706 additions and 808 deletions.
52 changes: 49 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,56 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: current
- name: Build
- name: Install node packages
run: npm ci
- name: Install mdBook
uses: baptiste0928/cargo-install@v2
with:
crate: mdbook
git: https://github.com/proskynova/mdBook
- name: Install mdbook-epub
uses: baptiste0928/cargo-install@v2
with:
crate: mdbook-epub
git: https://github.com/Michael-F-Bryan/mdbook-epub
- name: Install mdbook-typst-pdf
uses: baptiste0928/cargo-install@v2
with:
crate: mdbook-typst-pdf
git: https://github.com/KaiserY/mdbook-typst-pdf
- name: Install fonts
run: |
npm i
npm run docs:build
echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections
sudo apt-get -y install msttcorefonts
mkdir fonts
mkdir -p ~/.local/share/fonts
curl -sL -o Noto_Sans.zip https://fonts.google.com/download?family=Noto%20Sans
unzip Noto_Sans.zip -d fonts/Noto_Sans
curl -sL -o Noto_Sans_SC.zip https://fonts.google.com/download?family=Noto%20Sans%20SC
unzip Noto_Sans_SC.zip -d fonts/Noto_Sans_SC
curl -sL -o Noto_Sans_Mono.zip https://fonts.google.com/download?family=Noto%20Sans%20Mono
unzip Noto_Sans_Mono.zip -d fonts/Noto_Sans_Mono
rm -fv fonts/Noto_Sans_Mono/NotoSansMono-VariableFont_wdth,wght.ttf
curl -sL -o Noto_Sans_KR.zip https://fonts.google.com/download?family=Noto%20Sans%20KR
unzip Noto_Sans_KR.zip -d fonts/Noto_Sans_KR
curl -sL -o Noto_Sans_Thai.zip https://fonts.google.com/download?family=Noto%20Sans%20Thai
unzip Noto_Sans_Thai.zip -d fonts/Noto_Sans_Thai
rm -fv fonts/Noto_Sans_Thai/NotoSansThai-VariableFont_wdth,wght.ttf
curl -sL -o Noto_Sans_Arabic.zip https://fonts.google.com/download?family=Noto%20Sans%20Arabic
unzip Noto_Sans_Arabic.zip -d fonts/Noto_Sans_Arabic
curl -sL -o Noto_Sans_Hebrew.zip https://fonts.google.com/download?family=Noto%20Sans%20Hebrew
unzip Noto_Sans_Hebrew.zip -d fonts/Noto_Sans_Hebrew
curl -sL -o Noto_Sans_Devanagari.zip https://fonts.google.com/download?family=Noto%20Sans%20Devanagari
unzip Noto_Sans_Devanagari.zip -d fonts/Noto_Sans_Devanagari
rm -fv fonts/Noto_Sans_Devanagari/NotoSansDevanagari-VariableFont_wdth,wght.ttf
curl -sL -o Noto_Emoji.zip https://fonts.google.com/download?family=Noto%20Emoji
unzip Noto_Emoji.zip -d fonts/Noto_Emoji
curl -sL -o times_sans_serif.zip https://dl.dafont.com/dl/?f=times_sans_serif
unzip times_sans_serif.zip -d fonts/times_sans_serif
mv fonts/* ~/.local/share/fonts/
fc-cache -rv
- name: Build
run: npm run build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
book
src/.vitepress/cache
src/.vitepress/dist
node_modules
17 changes: 17 additions & 0 deletions book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[book]
title = "药娘的天空"
authors = ["乱世银娘"]
description = "《药娘的天空》精修版"
language = "zh-CN"

[build]
create-missing = false

[output.epub]
cover-image = "illustrations/cover.jpg"
no-section-label = true

[output.typst-pdf]
pdf = true
custom-template = "src/template.typ"
section-number = false
126 changes: 63 additions & 63 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"scripts": {
"docs:dev": "vitepress dev src",
"docs:build": "vitepress build src",
"docs:preview": "vitepress preview src"
"docs:preview": "vitepress preview src",
"build": "npm run docs:build && mdbook build && cp book/epub/*.epub src/.vitepress/dist/ && cp book/typst-pdf/*.pdf src/.vitepress/dist/"
}
}
2 changes: 2 additions & 0 deletions src/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default defineConfig({
],
lang: "zh-CN",
cleanUrls: true,
srcExclude: ["**/SUMMARY.md"],
lastUpdated: true,
sitemap: {
hostname: "https://proskynova.github.io",
Expand All @@ -35,6 +36,7 @@ export default defineConfig({
useFolderTitleFromIndexFile: true,
useFolderLinkFromIndexFile: true,
collapsed: true,
excludeFiles: ["SUMMARY.md"],
}),
socialLinks: [{ icon: "github", link: "https://github.com/proskynova" }],
footer: {
Expand Down
2 changes: 1 addition & 1 deletion src/01/002.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,4 @@

……

<style>.vp-doc>div>p{text-indent:2em}</style>
<style>.vp-doc>div>p{text-indent:2em}</style>
2 changes: 1 addition & 1 deletion src/01/003.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,4 @@

……

<style>.vp-doc>div>p{text-indent:2em}</style>
<style>.vp-doc>div>p{text-indent:2em}</style>
2 changes: 1 addition & 1 deletion src/01/004.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,4 @@

……

<style>.vp-doc>div>p{text-indent:2em}</style>
<style>.vp-doc>div>p{text-indent:2em}</style>
2 changes: 1 addition & 1 deletion src/01/005.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,4 @@

……

<style>.vp-doc>div>p{text-indent:2em}</style>
<style>.vp-doc>div>p{text-indent:2em}</style>
2 changes: 1 addition & 1 deletion src/01/006.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,4 @@

……

<style>.vp-doc>div>p{text-indent:2em}</style>
<style>.vp-doc>div>p{text-indent:2em}</style>
2 changes: 1 addition & 1 deletion src/01/007.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,4 @@

……

<style>.vp-doc>div>p{text-indent:2em}</style>
<style>.vp-doc>div>p{text-indent:2em}</style>
2 changes: 1 addition & 1 deletion src/01/008.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,4 @@

……

<style>.vp-doc>div>p{text-indent:2em}</style>
<style>.vp-doc>div>p{text-indent:2em}</style>
2 changes: 1 addition & 1 deletion src/01/009.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,4 @@

……

<style>.vp-doc>div>p{text-indent:2em}</style>
<style>.vp-doc>div>p{text-indent:2em}</style>
2 changes: 1 addition & 1 deletion src/01/010.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,4 +172,4 @@

……

<style>.vp-doc>div>p{text-indent:2em}</style>
<style>.vp-doc>div>p{text-indent:2em}</style>
2 changes: 1 addition & 1 deletion src/01/011.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,4 @@

……

<style>.vp-doc>div>p{text-indent:2em}</style>
<style>.vp-doc>div>p{text-indent:2em}</style>
2 changes: 1 addition & 1 deletion src/01/012.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,4 @@

……

<style>.vp-doc>div>p{text-indent:2em}</style>
<style>.vp-doc>div>p{text-indent:2em}</style>
Loading

0 comments on commit ff75293

Please sign in to comment.