Skip to content

Commit

Permalink
blog: update to 2.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lauset committed Dec 10, 2022
1 parent 83a6629 commit 316e12f
Show file tree
Hide file tree
Showing 170 changed files with 590 additions and 15,247 deletions.
16 changes: 11 additions & 5 deletions blog/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ export default defineConfigWithTheme<VuetomThemeConfig>({
title: 'Vuetom Blog',
titleTemplate: 'My Blog',
description: 'Just a blog',
appearance: true,
base: '/myblog',
ignoreDeadLinks: true,
lastUpdated: true,
themeConfig: {
nav: [
{ text: 'Guide', link: '/pages/guide' },
{ text: '首页', link: '/' },
{ text: '指导', link: '/pages/guide' },
{
text: 'More',
text: '更多',
items: [
{ text: '分类', link: '/categories/index' },
{ text: '标签', link: '/tags/index' }
Expand Down Expand Up @@ -55,10 +55,16 @@ export default defineConfigWithTheme<VuetomThemeConfig>({
},
bgImg: '/imgs/blog-bg.png',
avatar: '/imgs/avatar.jpg',
author: 'Vuetom'
author: 'Vuetom',
parallaxEnable: true,
},
markdown: {
theme: 'material-palenight',
lineNumbers: true
lineNumbers: false
},
vite: {
ssr: {
noExternal: ["vitepress-theme-vuetom"]
}
}
})
8 changes: 6 additions & 2 deletions blog/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
// .vitepress/theme/index.js
// import { BlogTheme } from '../../../vuetom/index'

import { BlogTheme } from 'vitepress-theme-vuetom'
// for prod
import BlogTheme from 'vitepress-theme-vuetom/blog'

// old
// import { BlogTheme } from 'vitepress-theme-vuetom'

import './custom.scss'

export default {
Expand Down
6 changes: 6 additions & 0 deletions blog/.vitepress/utils/paths.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import path from 'path'

export const vpRoot = path.resolve(__dirname, '..')
export const docRoot = path.resolve(vpRoot, '..')
export const pkgsRoot = path.resolve(docRoot, '..')
export const projRoot = path.resolve(pkgsRoot, '..')
16 changes: 9 additions & 7 deletions blog/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
{
"name": "blog",
"version": "0.0.1",
"name": "temp-blog",
"version": "2.3.0",
"scripts": {
"dev": "vitepress dev .",
"build": "vitepress build .",
"serve": "vitepress serve ."
"preview": "vitepress preview .",
"serve": "vitepress serve .",
"clean": "rimraf .vitepress/dist"
},
"devDependencies": {
"sass": "^1.54.8",
"vite": "^3.0.9",
"vitepress": "^1.0.0-alpha.13",
"vitepress-theme-vuetom": "workspace:^2.2.0"
"sass": "^1.56.1",
"vite": "^3.2.5",
"vitepress": "^1.0.0-alpha.30",
"vitepress-theme-vuetom": "^2.3.0"
}
}
2 changes: 1 addition & 1 deletion blog/pages/guide.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

Guide Page: /.vitepress/pages/guide.md
**Guide Page**: `/blog/pages/guide.md`
99 changes: 99 additions & 0 deletions blog/posts/codeblock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
---
title: 代码块展示
tags: example
categories: md
time: 2022-10-31 20:21:11
layout: doc
---

# {{ $frontmatter.title }}

## MD语法展示

使用三个 ` 符号将代码包裹其中便是展示代码块

<br/>

**亮/暗主题切换**

根据文档主题模式切换

**代码块主题 macos**

可以在 language_key(语言标识) 后加入 `macos`

输入内容:

<div>
```java macos
</div>
String language = "Java";
<div>
```
</div>

展示效果:

```java macos
String language = "Java";
```

<br/>

**默认主题**

默认主题是以暗色系为主的

输入内容:

<div>
```js
</div>
String language = "JS";
<div>
```
</div>

输出内容:

```java
String language = "JS";
```

<br/>

**示例展示**

- javascript ( js macos )

```js macos
function fun(){
echo "Hello, World!";
}
fun();
```

- Java ( java )

```java
System.out.print(1);
```

- Python ( py macos )

```py macos
#!/usr/bin/env python3
print("Hello, World!");
```

- SQL ( sql )

```sql
select user_name from user_info
```

- Shell ( bash, shell )

```bash
echo '1'
```
Binary file added blog/public/imgs/blog-bg-cloud.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added blog/public/imgs/blog-bg-grass.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added blog/public/imgs/blog-bg-human.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added blog/public/imgs/cloud2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
151 changes: 151 additions & 0 deletions blog/public/js/leaf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
var stop, staticx;
var img = new Image();
img.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAD/klEQVRYR+VXS2wTVxSdN/Nmxo5/Y0N+CoKI/GhCEgeIg9SopCtYIISABZuiqdQuUFm4XVTqpgpVFl1UFVKrdoPEsAA2iI/KoqhSQxAp2DGOLVBCfiVqmg+gOPY4tuPMr/OiTOQOJjMmI7FgVjPzPPeed8499z4D7B1fYEv52U4/ieGHCFLp8jH07sUlYTh/8dHZUmK+FQDb54Gr23x0pddDEg4nrIIE3oSSCoIci8aSt0Uu3GsWRMkACLaT3d/hDZIQb19LKspx7R49T89k7swupD/BuFjSDIiSAVR81f17Q53zsBZ8MZEfUNk4pD2LghyJxlJXBC50wXIABBs43t7q/tZugx1vApDJiINPRvgfJC58y3IAri8OXm9rZk4WBkYMMB5YTRBEYy4n9j95ynsVDFOTywMiF7lnBKIkCdTi+75tL3OkUHMEwO0mGUiA2sTS6jBtIyBN4s7heDIuXAqz1gFQLUcA0I4roMfDQH/97rIytOuVvBQmCEAXgkJJR56l7i399PBjywBANtDb1uo+ls1KKY+HrN6wnuoClEQPYGY2O/jPHH/UyA2mJSimv2bDYgCQNJNT6V6jOjANoObr7j9rdzlfoxT1AZ4XkoVWlGV5dnwiHV3kc2csY6D8y+4HDXWOVgCAu1DXQgCKovCJ5Gr0+XSWlETlDxFTbmPcUGyzOjDNAMb6GRtJ/dLygafORhMBvRURA6Ikj6VSwjxaoyhYNjrKXzNqSKYBkJ8GOBnD+oECWIaBXrUbbsNxsAMl03dDDVxoKHHeaC6YAgDZAz21Ox3nfT56jX6SxP3FGNBTHY4kLhv1AtMAOtp9P1MU3lJMz/HJ5cHGeueH+rVQJDEgXgr3bLkGEAP7OnwX9F7XAo9NpONNDa616ahdkihPRYZTd0QuFLQEwN5mps/hgK/tEgV/8SJ3v7LS/hG6Rxacn8+P/DuX+8tIf/R7UxIgB3hd9psN9S5vMRZQEfq8lH85I4/NLWQpHICFXF7MpDNSn3U2VNGiwwjjhifKK2wudfjgHje1tutiLkCsTH43sHFOeJMM5hhQv0azYPt2ulblTCFwbGdVpc2h9oMuFPjlq5W7FeW2jUMKejcxtXz35Y8Pjmymv3kJ1nfvb2PO6psQCqIvQlQHQ4+TF62rAZRFrYOaCueNYvNAD+DVYj40/nfuNMY9mraMARSIZLuCLc2uU3o36F0QjfO/mT2em64BbSf0Zwd/3VPv3O90wU7tnVaEiiIvj42n+81MQe3bkgGgD1Fjsjvgueoqew0FQZ5PSwQFFWlmbnU0L658YzSCC2V5KwD/0xX9OwIgKCirwVISb4kBfWEhi5qp+GIFuXUG1nvE+w3AyOubrf8HHtHAMOVEwKEAAAAASUVORK5CYII="

function Sakura(x, y, s, r, fn) {
this.x = x;
this.y = y;
this.s = s;
this.r = r;
this.fn = fn;
}
Sakura.prototype.draw = function (cxt) {
cxt.save();
var xc = 40 * this.s / 4;
cxt.translate(this.x, this.y);
cxt.rotate(this.r);
cxt.drawImage(img, 0, 0, 40 * this.s, 40 * this.s)
cxt.restore();
}
Sakura.prototype.update = function () {
this.x = this.fn.x(this.x, this.y);
this.y = this.fn.y(this.y, this.y);
this.r = this.fn.r(this.r);
if (this.x > window.innerWidth || this.x < 0 || this.y > window.innerHeight || this.y < 0) {
this.r = getRandom('fnr');
if (Math.random() > 0.4) {
this.x = getRandom('x');
this.y = 0;
this.s = getRandom('s');
this.r = getRandom('r');
} else {
this.x = window.innerWidth;
this.y = getRandom('y');
this.s = getRandom('s');
this.r = getRandom('r');
}
}
}
SakuraList = function () {
this.list = [];
}
SakuraList.prototype.push = function (sakura) {
this.list.push(sakura);
}
SakuraList.prototype.update = function () {
for (var i = 0, len = this.list.length; i < len; i++) {
this.list[i].update();
}
}
SakuraList.prototype.draw = function (cxt) {
for (var i = 0, len = this.list.length; i < len; i++) {
this.list[i].draw(cxt);
}
}
SakuraList.prototype.get = function (i) {
return this.list[i];
}
SakuraList.prototype.size = function () {
return this.list.length;
}

function getRandom(option) {
var ret, random;
switch (option) {
case 'x':
ret = Math.random() * window.innerWidth;
break;
case 'y':
ret = Math.random() * window.innerHeight;
break;
case 's':
ret = Math.random();
break;
case 'r':
ret = Math.random() * 6;
break;
case 'fnx':
random = -0.5 + Math.random() * 1;
ret = function (x, y) {
return x + 0.5 * random - 1.7;
};
break;
case 'fny':
random = 1.5 + Math.random() * 0.7
ret = function (x, y) {
return y + random;
};
break;
case 'fnr':
random = Math.random() * 0.03;
ret = function (r) {
return r + random;
};
break;
}
return ret;
}

function startSakura() {
requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || window.oRequestAnimationFrame;
var canvas = document.createElement('canvas'),
cxt;
staticx = true;
canvas.height = window.innerHeight;
canvas.width = window.innerWidth;
canvas.setAttribute('style', 'position: fixed;left: 0;top: 0;pointer-events: none; z-index: 100;');
canvas.setAttribute('id', 'canvas_sakura');
document.getElementsByTagName('body')[0].appendChild(canvas);
cxt = canvas.getContext('2d');
var sakuraList = new SakuraList();
for (var i = 0; i < 30; i++) {
var sakura, randomX, randomY, randomS, randomR, randomFnx, randomFny;
randomX = getRandom('x');
randomY = getRandom('y');
randomR = getRandom('r');
randomS = getRandom('s');
randomFnx = getRandom('fnx');
randomFny = getRandom('fny');
randomFnR = getRandom('fnr');
sakura = new Sakura(randomX, randomY, randomS, randomR, {
x: randomFnx,
y: randomFny,
r: randomFnR
});
sakura.draw(cxt);
sakuraList.push(sakura);
}
stop = requestAnimationFrame(function () {
cxt.clearRect(0, 0, canvas.width, canvas.height);
sakuraList.update();
sakuraList.draw(cxt);
stop = requestAnimationFrame(arguments.callee);
})
}
window.onresize = function () {
var canvasSnow = document.getElementById('canvas_snow');
}
img.onload = function () {
startSakura();
}

function stopp() {
if (staticx) {
var child = document.getElementById("canvas_sakura");
child.parentNode.removeChild(child);
window.cancelAnimationFrame(stop);
staticx = false;
} else {
startSakura();
}
}
11 changes: 0 additions & 11 deletions blog/vite.config.ts

This file was deleted.

Loading

0 comments on commit 316e12f

Please sign in to comment.