Skip to content

Commit

Permalink
🔨 修复图片问题与更新构建方式
Browse files Browse the repository at this point in the history
  • Loading branch information
wling-art committed Oct 20, 2024
1 parent 61230d2 commit ffa9645
Show file tree
Hide file tree
Showing 18 changed files with 4,279 additions and 79 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Build Docs

on:
push:
branches:
- "main"
env:
STORE_PATH: ""

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: 拉取代码
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install Node.js 22.x
uses: actions/setup-node@v4
with:
node-version: 22.x

- uses: pnpm/action-setup@v3
name: Install pnpm
with:
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build docs
run: pnpm docs:build
env:
# As suggested in Verbose Build option to be able to track down errors https://github.com/vuejs/vitepress/issues/422
# vitepress build command does not have --debug option, so we need to set it manually where the debug package is used.
# DEBUG: 'vitepress:*'
VUE_PROD_HYDRATION_MISMATCH_DETAILS_FLAG: "1"

- name: Deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy docs/.vitepress/dist --project-name='u1-wiki'
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,11 @@ dist
.yarn/install-state.gz
.pnp.*

cache/
cache/

# Obsidian

**/.obsidian/*
!**/.obsidian/workspace*
!**/.obsidian/graph*
!**/.obsidian/snippets/
22 changes: 22 additions & 0 deletions .obsidian/graph.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"collapse-filter": false,
"search": "",
"showTags": true,
"showAttachments": false,
"hideUnresolved": false,
"showOrphans": true,
"collapse-color-groups": false,
"colorGroups": [],
"collapse-display": false,
"showArrow": false,
"textFadeMultiplier": 1,
"nodeSizeMultiplier": 0.996419270833333,
"lineSizeMultiplier": 0.503272727272727,
"collapse-forces": false,
"centerStrength": 0.427993617573936,
"repelStrength": 10.0812646109318,
"linkStrength": 0.903707002115106,
"linkDistance": 400,
"scale": 0.2195571709619205,
"close": true
}
198 changes: 198 additions & 0 deletions .obsidian/workspace.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
{
"main": {
"id": "02c5827de22e9742",
"type": "split",
"children": [
{
"id": "4303e7d59dbb1ba2",
"type": "tabs",
"children": [
{
"id": "9bff2921bb9bcfaa",
"type": "leaf",
"state": {
"type": "markdown",
"state": {
"file": "docs/yaoyi-func/天气.md",
"mode": "source",
"source": false
},
"icon": "lucide-file",
"title": "天气"
}
}
]
}
],
"direction": "vertical"
},
"left": {
"id": "cddcb8edd99de182",
"type": "split",
"children": [
{
"id": "349701b5fe333137",
"type": "tabs",
"children": [
{
"id": "ee8c995f528b8456",
"type": "leaf",
"state": {
"type": "file-explorer",
"state": {
"sortOrder": "alphabetical"
},
"icon": "lucide-folder-closed",
"title": "文件列表"
}
},
{
"id": "3efae3696b89b4d1",
"type": "leaf",
"state": {
"type": "search",
"state": {
"query": "",
"matchingCase": false,
"explainSearch": false,
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical"
},
"icon": "lucide-search",
"title": "搜索"
}
},
{
"id": "b0ddfad506c0acdd",
"type": "leaf",
"state": {
"type": "bookmarks",
"state": {},
"icon": "lucide-bookmark",
"title": "书签"
}
}
]
}
],
"direction": "horizontal",
"width": 300
},
"right": {
"id": "426b09b237c2cf96",
"type": "split",
"children": [
{
"id": "a7fa240e9b5e615b",
"type": "tabs",
"children": [
{
"id": "066ec45b68e19071",
"type": "leaf",
"state": {
"type": "backlink",
"state": {
"file": "docs/yaoyi-func/天气.md",
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical",
"showSearch": false,
"searchQuery": "",
"backlinkCollapsed": false,
"unlinkedCollapsed": true
},
"icon": "links-coming-in",
"title": "天气 的反向链接列表"
}
},
{
"id": "56a340a3c009e595",
"type": "leaf",
"state": {
"type": "outgoing-link",
"state": {
"linksCollapsed": false,
"unlinkedCollapsed": true
},
"icon": "links-going-out",
"title": "出链"
}
},
{
"id": "02cc25663d21b4d7",
"type": "leaf",
"state": {
"type": "tag",
"state": {
"sortOrder": "frequency",
"useHierarchy": true
},
"icon": "lucide-tags",
"title": "标签"
}
},
{
"id": "9e4ff55c325c0e1e",
"type": "leaf",
"state": {
"type": "outline",
"state": {
"file": "docs/yaoyi-func/天气.md"
},
"icon": "lucide-list",
"title": "天气 的大纲"
}
}
],
"currentTab": 3
}
],
"direction": "horizontal",
"width": 290.5,
"collapsed": true
},
"left-ribbon": {
"hiddenItems": {
"switcher:打开快速切换": false,
"graph:查看关系图谱": false,
"canvas:新建白板": false,
"daily-notes:打开/创建今天的日记": false,
"templates:插入模板": false,
"command-palette:打开命令面板": false,
"obsidian42-brat:BRAT": false
}
},
"active": "9bff2921bb9bcfaa",
"lastOpenFiles": [
"docs/vite.config.mts.timestamp-1729435823708-e87e578b335a1.mjs",
"docs/vite.config.mts.timestamp-1729435770719-dc28cadde53da.mjs",
"docs/vite.config.mts.timestamp-1729435757073-e145b4a508be3.mjs",
"docs/vite.config.mts",
"docs/uno.config.mts",
"vite.config.mts.timestamp-1729435566233-e699c29ed56a3.mjs",
"_tmp_42732_3fe6baa4819760690cafac9e03a549a6",
"vite.config.mts.timestamp-1729435082344-8118bfd5ec56f.mjs",
"vite.config.mts.timestamp-1729435076117-e399294989114.mjs",
"vite.config.mts.timestamp-1729434066777-96c8619237add.mjs",
"vite.config.mts.timestamp-1729434059799-103aa5224cf74.mjs",
"docs/yaoyi-func/Github Card.md",
"docs/yaoyi-func/天气.md",
"docs/others/support.md",
"docs/FAQ.md",
"docs/yaoyi-func/网抑云.md",
"docs/yaoyi-func/assets/天气.png",
"docs/index.md",
"docs/intro.md",
"docs/jieshao.md",
"README.md",
"docs/yaoyi-func/塔罗牌.md",
"docs/yaoyi-func/B站视频分析.md",
"docs/yaoyi-func/assets/github_card.png",
"docs/about/contact.md",
"docs/yaoyi-func/今天吃什么.md",
"未命名.canvas",
"未命名 2.canvas",
"未命名 1.canvas"
]
}
43 changes: 11 additions & 32 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -1,32 +1,15 @@
import { defineConfig } from "vitepress";
import { InlineLinkPreviewElementTransform } from "@nolebase/vitepress-plugin-inline-link-preview/markdown-it";
import pkg from "../../package.json";
import { ThumbnailHashImages } from "@nolebase/vitepress-plugin-thumbnail-hash/vite";
import { PageProperties } from "@nolebase/vitepress-plugin-page-properties/vite";
import { UnlazyImages } from "@nolebase/markdown-it-unlazy-img";
// https://vitepress.dev/reference/site-config
import { BiDirectionalLinks } from "@nolebase/markdown-it-bi-directional-links";

export default defineConfig({
vite: {
plugins: [ThumbnailHashImages(), PageProperties()],
optimizeDeps: {
exclude: [
"@nolebase/vitepress-plugin-enhanced-readabilities/client",
"vitepress",
"@nolebase/ui",
"@nolebase/vitepress-plugin-inline-link-preview",
"@nolebase/vitepress-plugin-highlight-targeted-heading",
],
},
ssr: {
noExternal: [
// 如果还有别的依赖需要添加的话,并排填写和配置到这里即可
"@nolebase/vitepress-plugin-thumbnail-hash",
"@nolebase/markdown-it-unlazy-img",
"@nolebase/vitepress-plugin-enhanced-readabilities",
"@nolebase/ui",
"@nolebase/vitepress-plugin-highlight-targeted-heading",
"@nolebase/vitepress-plugin-inline-link-preview",
],
vue: {
template: {
transformAssetUrls: {
NolebaseUnlazyImg: ["src"],
},
},
},
lastUpdated: true,
Expand Down Expand Up @@ -122,18 +105,14 @@ export default defineConfig({
darkModeSwitchTitle: "切换到深色模式",
},
markdown: {
config(md) {
// 其他 markdown-it 配置...

md.use(InlineLinkPreviewElementTransform);
config: (md) => {
md.use(UnlazyImages(), {
imgElementTag: "NolebaseUnlazyImg",
});
md.use(BiDirectionalLinks());
md.use(InlineLinkPreviewElementTransform);
},
image: {
// 图片懒加载
lazyLoading: true,
},

container: {
tipLabel: "提示",
warningLabel: "警告",
Expand Down
Loading

0 comments on commit ffa9645

Please sign in to comment.