Skip to content

Commit f0ac4a9

Browse files
committed
重新整理文档笔记
0 parents  commit f0ac4a9

File tree

2,582 files changed

+285255
-0
lines changed

Some content is hidden

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

2,582 files changed

+285255
-0
lines changed

.github/workflows/algolia.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: algolia
2+
on:
3+
push:
4+
branches:
5+
- main
6+
jobs:
7+
algolia:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
- name: Get the content of algolia.json as config
12+
id: algolia_config
13+
run: echo "config=$(cat crawlerConfig.json | jq -r tostring)" >> $GITHUB_OUTPUT
14+
- name: Push indices to Algolia
15+
uses: signcl/docsearch-scraper-action@master
16+
env:
17+
APPLICATION_ID: ${{ secrets.APPLICATION_ID }}
18+
API_KEY: ${{ secrets.API_KEY }}
19+
CONFIG: ${{ steps.algolia_config.outputs.config }}

.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
.DS_Store
2+
node_modules
3+
4+
scripts/docsearch-scraper
5+
6+
# 缓存
7+
docs/.vitepress/cache
8+
docs/.vitepress/.temp
9+
docs/.vitepress/dist
10+
11+
# local env files
12+
.env.local
13+
.env.*.local
14+
15+
# Log files
16+
npm-debug.log*
17+
yarn-debug.log*
18+
yarn-error.log*
19+
20+
# Editor directories and files
21+
.idea
22+
.vscode
23+
*.suo
24+
*.ntvs*
25+
*.njsproj
26+
*.sln
27+
*.sw?

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 muyaCode
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# FrontEndLearnNotes/前端学习笔记
2+
3+
**vitepress 框架的 markdown 写作相关文档**<https://vitepress.vuejs.org/guide/markdown>
4+
5+
## 解决 Node 项目打包内存溢出报错:JS stacktrace
6+
7+
安装依赖后,运行或打包项目报错:vitepress 内存溢出(JS stacktrace),是因为内存设置不足
8+
9+
需要在 `node_modules/.bin/vitepress` 文件 和 `node_modules/.bin/vitepress.CMD` 文件修改增加运行内存:
10+
11+
**vitepress** 文件
12+
13+
```bash
14+
if [ -x "$basedir/node" ]; then
15+
exec "$basedir/node" " --max_old_space_size=49152 $basedir/../vitepress/bin/vitepress.js" "$@"
16+
else
17+
exec node --max_old_space_size=49152 "$basedir/../vitepress/bin/vitepress.js" "$@"
18+
fi
19+
```
20+
21+
**vitepress.CMD** 文件
22+
23+
```bash
24+
@IF EXIST "%~dp0\node.exe" (
25+
"%~dp0\node.exe --max_old_space_size=49152" "%~dp0\..\vitepress\bin\vitepress.js" %*
26+
) ELSE (
27+
@SET PATHEXT=%PATHEXT:;.JS;=;%
28+
node --max_old_space_size=49152 "%~dp0\..\vitepress\bin\vitepress.js" %*
29+
)
30+
```

crawlerConfig.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"index_name": "FrontEndLearnNotes",
3+
"start_urls": ["https://muyacode.github.io/FrontEndLearnNotes/"],
4+
"rateLimit": 8,
5+
"maxDepth": 10,
6+
"selectors": {
7+
"lvl0": {
8+
"selector": "",
9+
"defaultValue": "Documentation"
10+
},
11+
"lvl1": ".content h1",
12+
"lvl2": ".content h2",
13+
"lvl3": ".content h3",
14+
"lvl4": ".content h4",
15+
"lvl5": ".content h5",
16+
"content": ".content p, .content li"
17+
},
18+
"selectors_exclude": [
19+
"aside",
20+
".page-footer",
21+
".next-and-prev-link",
22+
".table-of-contents"
23+
],
24+
"js_render": true
25+
}

deploy.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env sh
2+
3+
# 确保脚本抛出遇到的错误
4+
set -e
5+
6+
# 打包生成静态文件
7+
pnpm run docs:build
8+
9+
# 进入生成的文件夹
10+
cd docs/.vitepress/dist
11+
12+
# 如果是发布到自定义域名
13+
# echo 'www.example.com' > CNAME
14+
15+
time=$(date "+%Y-%m-%d %H:%M:%S")
16+
17+
git init
18+
git add -A
19+
git commit -m "GitHub Action 自动部署:$time"
20+
21+
# # 如果发布到 https://<USERNAME>.github.io -f 强制推送
22+
# git push -f [email protected]:<USERNAME>/<USERNAME>.github.io.git master
23+
git push -f [email protected]:muyaCode/FrontEndLearnNotes.git master:gh-pages # 发布到Gitee
24+
# git push -f [email protected]:muyaCode/FrontEndLearnNotes.git master:gh-pages # 发布到GitHub
25+
26+
27+
# 退出到本项目根目录
28+
cd -
29+
# 删除 打包成的dist文件目录
30+
rm -rf docs/.vitepress/dist
31+
32+
33+
# 输出仓库和文档地址
34+
# echo "仓库地址:https://github.com/muyaCode/FrontEndLearnNotes"
35+
# echo "文档地址:https://muyacode.github.io/FrontEndLearnNotes/"
36+
37+
# 格式化输出带颜色配置:https://www.shuzhiduo.com/A/D854N3mVzE/
38+
echo -e "Gitee仓库地址:\033[44;37m https://gitee.com/muyaCode/FrontEndLearnNotes/ \033[0m"
39+
echo -e "GiteePages文档地址:\033[47;30m https://muyacode.gitee.io/FrontEndLearnNotes/ \033[0m"
40+
echo -e "————————————————————————————————————————————————————————————————————————————————————————"
41+
echo -e "GitHub仓库地址:\033[44;37m https://github.com/muyaCode/FrontEndLearnNotes/ \033[0m"
42+
echo -e "GitHubPages文档地址:\033[47;30m https://muyacode.github.io/FrontEndLearnNotes/ \033[0m"

docs/.vitepress/config.js

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
import { defineConfig } from "vitepress";
2+
import config from "genji-theme-vitepress/config";
3+
4+
import socialLinks from "./config/socialLinks";
5+
import nav from "./config/nav";
6+
// import algolia from "./config/algolia";
7+
import sidebar from "./config/sidebar";
8+
import search from "./config/search";
9+
10+
// 配置文档:https://vitepress.dev/reference/site-config
11+
export default defineConfig({
12+
// 报错:SyntaxError: Invalid end tag. 会输出报错所在的目录:https://vitepress.dev/zh/reference/site-config#transformpagedata
13+
// async transformPageData(pageData, { siteConfig }) {
14+
// pageData.contributors = await getPageContributors(pageData.relativePath)
15+
// },
16+
17+
// 代码块运行插件文档:https://genji-md.dev/getting-started
18+
extends: config,
19+
20+
lang: "zh", // 中文,英文设置en-US
21+
title: "牡涯前端学习笔记", // 浏览器标签标题
22+
description: "记录前端学习过的笔记",
23+
base: '/FrontEndLearnNotes/', // url默认前缀
24+
appearance: true, // 暗黑模式
25+
ignoreDeadLinks: true, // 不会因死链接而使构建失败
26+
lastUpdated: true, // 使用 git 提交获取时间戳,使默认主题能够显示页面的上次更新时间
27+
// markdown主题
28+
markdown: {
29+
// 主题选择:https://github.com/shikijs/shiki/blob/main/docs/themes.md#all-themes
30+
// 主题预览:https://vscodethemes.com/
31+
// 添加自定义的主题(加载主题):https://github.com/shikijs/shiki/blob/main/docs/themes.md#loading-theme
32+
theme: "one-dark-pro",
33+
lineNumbers: true, // 显示代码行数
34+
// markdown-it-attrs 插件忽略
35+
attrs: {
36+
leftDelimiter: '[[',
37+
rightDelimiter: ']]'
38+
}
39+
},
40+
// outDir: "../dist", // 打包输出的目录
41+
// titleTemplate: '牧涯前端学习笔记', // 标题后缀
42+
cleanUrls: true, // url是否带.html后缀
43+
// 浏览器标签图标设置
44+
head: [
45+
[
46+
'link',
47+
{
48+
rel: 'icon',
49+
href: 'https://avatars.githubusercontent.com/u/48587992?v=4'
50+
}
51+
]
52+
// ['link', { rel: 'icon', type: 'image/svg+xml', href: '/logo.svg' }],
53+
],
54+
55+
// ***** 主题设置 *****
56+
// 文档:https://vitepress.vuejs.org/config/theme-configs
57+
themeConfig: {
58+
logo: "/img/buding.svg",
59+
siteTitle: "牧涯前端学习笔记", // 网站左上角标题
60+
outlineTitle: '⚡️文档内容大纲', // 大纲标题
61+
outline: 'deep', // 大纲显示层级:number:只显示 | [number, number]:指定层级范围显示 | 'deep':全部显示 | false:不显示
62+
63+
// 使用浏览器内置索引进行模糊全文搜索
64+
search,
65+
66+
// 使用 algolia 搜索框
67+
// search: {
68+
// provider: 'algolia',
69+
// options: algolia,
70+
// },
71+
// 右上角导航
72+
nav,
73+
// 右上角导航中显示带有图标的社交帐户链接
74+
socialLinks,
75+
// *****左边侧栏导航*****
76+
sidebar,
77+
78+
79+
// 编辑
80+
editLink: {
81+
pattern: 'https://github.com/muyaCode/FrontEndLearnNotes/edit/main/docs/:path',
82+
text: '在 GitHub 上编辑此页'
83+
},
84+
// 自定义上次更新的文本和日期格式
85+
lastUpdated: {
86+
text: '上次更新:',
87+
formatOptions: {
88+
dateStyle: 'full',
89+
timeStyle: 'medium'
90+
}
91+
},
92+
docFooter: {
93+
prev: '上一篇',
94+
next: '下一篇'
95+
},
96+
97+
// 右边文档大纲下面的-卡片广告
98+
// carbonAds: {
99+
// code: '卡片广告 code',
100+
// placement: '卡片广告布置'
101+
// },
102+
103+
// 首页页脚配置。您可以添加消息和版权。仅当页面由于设计原因不包含边栏时,才会显示页脚。
104+
footer: {
105+
message: 'Released under the MIT License.',
106+
copyright: 'Copyright © 2022-2023 MuYa'
107+
},
108+
},
109+
});

docs/.vitepress/config/algolia.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// 展示 algolia 搜索框
2+
export default {
3+
appId: '1L6FRXPKEM',
4+
apiKey: '934b4c2e67a08d72d379c9af236c5859',
5+
indexName: 'FrontEndLearnNotes',
6+
placeholder: '请输入关键词',
7+
buttonText: '搜索',
8+
searchParameters: {
9+
faeFilters: ['tags:guide,api']
10+
}
11+
}

docs/.vitepress/config/nav.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// 右上角导航
2+
const nav = [
3+
{
4+
text: "🌍我的个人网站",
5+
link: "",
6+
},
7+
{
8+
text: "✨掘金文章",
9+
link: "",
10+
},
11+
{
12+
text: "🔧设置",
13+
link: "/order/setting",
14+
},
15+
{
16+
text: "👇下拉选择",
17+
items: [
18+
{
19+
text: "选择1",
20+
link: "/order/items/item1",
21+
},
22+
{
23+
text: "选择2",
24+
link: "/order/items/item2",
25+
},
26+
{
27+
text: "选择3",
28+
link: "/order/items/item3",
29+
},
30+
{
31+
text: "选择4",
32+
link: "/order/items/item4",
33+
},
34+
],
35+
},
36+
];
37+
38+
export default nav;

docs/.vitepress/config/search.js

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
const search = {
2+
provider: 'local',
3+
options: {
4+
locales: {
5+
root: {
6+
translations: {
7+
button: {
8+
buttonText: '搜索文档',
9+
buttonAriaLabel: '搜索文档'
10+
},
11+
modal: {
12+
noResultsText: '无法找到相关结果',
13+
displayDetails: '显示详细信息',
14+
resetButtonTitle: '清除查询条件',
15+
backButtonTitle: '返回搜索结果',
16+
footer: {
17+
selectText: '选择',
18+
selectKeyAriaLabel: 'enter',
19+
navigateText: '切换',
20+
navigateUpKeyAriaLabel: 'up arrow',
21+
navigateDownKeyAriaLabel: 'down arrow',
22+
closeText: '关闭',
23+
closeKeyAriaLabel: 'escape'
24+
}
25+
}
26+
}
27+
}
28+
},
29+
30+
_render(src, env, md) {
31+
const html = md.render(src, env)
32+
if (env.frontmatter?.search === false) return ''
33+
// 从搜索中排除页面
34+
if (env.relativePath.startsWith('some/path')) return ''
35+
// 转换内容——添加锚点
36+
if (env.frontmatter?.title) return md.render(`# ${env.frontmatter.title}`) + html
37+
return html
38+
},
39+
// 搜索配置
40+
miniSearch: {
41+
/**
42+
* @type {Pick<import('minisearch').Options, 'extractField' | 'tokenize' | 'processTerm'>}
43+
*/
44+
options: {
45+
/* ... */
46+
},
47+
/**
48+
* @type {import('minisearch').SearchOptions}
49+
* @default
50+
* { fuzzy: 0.2, prefix: true, boost: { title: 4, text: 2, titles: 1 } }
51+
*/
52+
searchOptions: {
53+
/* ... */
54+
}
55+
},
56+
}
57+
}
58+
59+
export default search;

0 commit comments

Comments
 (0)