技巧 - 笔记
# 技巧 - 笔记
笔记
如果想拥有更多丰富的笔记表现力,让自己阅读时,不处于大片黑白的世界里,本内容会让你的笔记句句深入记忆的深处 😸
2022-03-11 @Jamey
笔记
本内容来自 VuePress官网 (opens new window) 和 vdoing主题官网 (opens new window),有部分是自己总结的。
信息框容器后的内容,基本都是 vdoing主题
带有的。
2022-03-11 @Jamey
# 一. 使用 emoji 表情
阅读大片大片的文字难免产生视觉疲劳,而使用 emoji 表情,不仅缓解精神的渐眠,也会胜过千言。
在 markdown 里,使用 :表情:
输入表情,如
你好 :smile:,我喜欢 :dog:,我小时候经常拿 :100: 分哦~~~,欢迎来到我的博客 :heart:,一起学习吧 :muscle:
效果如下:
你好 😄,我喜欢 🐶,我小时候经常拿 💯 分哦~~~,欢迎来到我的博客 ❤️,一起学习吧 💪
很多指令肯定是记不了的,我们可以也可以去特定的网站获取表情的格式。也可以 copy 一个表情过来,markdown 自动解析表情。
分享一些 emoji 网站:
- emoji 表情备忘录 (opens new window):有很多表情的格式(
:表情:
) - emoji 表情 (opens new window):有很多表情可以copy
- gitmoji (opens new window) 通过 emoji 表达 git 的操作内容
macOS 系统下按 control + command + space(空格键)
Windows 系统下按 Win + . 快速打开表情选择框(不是右侧小键盘的 .)
# 二. 外部链接
使用外部链接,文字会变色,并且可以点击跳转,格式如下:
[VuePress官网](https://vuepress.vuejs.org/zh/)
效果如下:
# 三. 文本高亮
使用 <mark>
标签或者 ``
让文本高亮。
<mark>
标签我经常用于文字的突出,如果是一段字符串,我是用的是 ``
包裹起来。
`Vdoing` 是一款简洁高效的 <mark>知识管理&博客</mark> 主题
Vdoing
是一款简洁高效的 知识管理&博客 主题
# 四. 代码高亮
突出代码块的某些行,使用 {行数-行数}、{行数,行数} 格式,如
输入:
``` js {2,5-7,13}
return {
// 数据
options,
activeKey,
sourceLabels,
sourceForm,
addForm,
addRules,
sourceRules,
// 函数
displayRender,
submitProdoce,
onAddClose,
};
```
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
输出:
return {
// 数据
options,
activeKey,
sourceLabels,
sourceForm,
addForm,
addRules,
sourceRules,
// 函数
displayRender,
submitProdoce,
onAddClose,
};
2
3
4
5
6
7
8
9
10
11
12
13
14
- 行数区间: 例如
{5-8}
,{3-10}
,{10-17}
- 多个单行: 例如
{4,7,9}
- 行数区间与多个单行: 例如
{4,7-13,16,23-27,40}
# 五. 徽章
# 1. 内置
官方自带。详细使用可前往官网 Badge (opens new window)。
#### 《沁园春·雪》 <Badge text="摘"/>
北国风光<Badge text="注释" type="warning"/>,千里冰封,万里雪飘。
> <Badge text="译文" type="error" vertical="middle"/>:北方的风光。
2
3
4
5
type
有三个参数:tip、warning、error。默认是 tipvertical
有两个参数:top、middle。默认是 top
直接在 markdown 文件使用,效果如下:
# 《沁园春·雪》 摘
北国风光注释,千里冰封,万里雪飘。
译文:北方的风光。
# 2. 外置
如果想用更多的自定义徽章,可使用 Shields (opens new window)来生成



2
3
# 六. 信息框容器
以下一些内容是 Vdoing 主题提供,并非官方提供。
输入:
::: tip
这是一条提示
:::
::: warning
这是一条注意
:::
::: danger
这是一条警告
:::
::: note
这是笔记容器,主题自带,官方没有
:::
::: tip 我的自定义标题
自定义标题的提示框
:::
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
输出:
提示
这是一条提示
注意
这是一条注意
警告
这是一条警告
笔记
这是笔记容器,主题自带,官方没有
我的自定义标题
自定义标题的提示框
如果想要折叠的容器,如下:也可以自定义标题
::: details
这是一个详情块,在 IE / Edge 中不生效
```js
console.log('这是一个详情块')
```
:::
2
3
4
5
6
点击查看
这是一个详情块,在 IE / Edge 中不生效
console.log('这是一个详情块')
# 七. 布局容器
::: center
#### 我是居中的内容
(可用于标题、图片等的居中)
:::
::: right
[我是右浮动的内容](https://cdn.staticaly.com/gh/Kele-Bingtang/static/user/avatar2.png)
:::
::: theorem VuePress
Vue 驱动的静态网站生成器
::: right
来自 [官网](https://vuepress.vuejs.org/zh/)
:::
2
3
4
5
6
7
8
9
10
11
12
13
14
# 我是居中的内容
(可用于标题、图片等的居中)
注意
没有 left 和 top、bottom
# 八. 代码块选项卡v1.8.0+
在 <code-group>
中嵌套 <code-block>
来配合使用。在 <code-block>
标签添加 title
来指定tab标题,active
指定当前 tab:
<code-group>
<code-block title="YARN" active>
```bash
yarn add vuepress-theme-vdoing -D
```
</code-block>
<code-block title="NPM">
```bash
npm install vuepress-theme-vdoing -D
```
</code-block>
</code-group>
2
3
4
5
6
7
8
9
10
11
12
13
效果如下:
yarn add vuepress-theme-vdoing -D
npm install vuepress-theme-vdoing -D
// Make sure to add code blocks to your code group
注意
请在 <code-group>
标签与 markdown 内容之间使用空行隔开,否则可能会解析不出来。
提示
Vdoing
解释该组件仅适用于放置代码块,放其他内容在体验上并不友好。经过测试,我放入文字也是可以的。
而且 <code-block> 放在 <code-group> 里时,首行缩进两个空格,经过测试,四个空格 出问题。
如果你喜欢 ::: tabs
代替 <code-group>
,那么我们可以下载 vuepress-plugin-tabs
插件。点击跳到 Tabs 插件安装。
# 九. 普通卡片列表
如果想使用 友链 功能,但是 vdoing 主题并没有直接在首页实现该功能,要么使用 卡片列表,要么自己手动实现html。而 卡片列表 目前只能使用在 markdown 文档里,下方介绍。
普通卡片列表容器,可用于 友情链接
、项目推荐
、诗词展示
等。
输入:
::: cardList
```yaml
- name: butcher2000
desc: 即使再小的帆,也能远航
avatar: https://cdn.staticaly.com/gh/Kele-Bingtang/static/user/20211029181901.png
link: https://blog.csdn.net/weixin_46827107
bgColor: '#CBEAFA' # 可选,默认var(--bodyBg)。颜色值有#号时请添加单引号
textColor: '#6854A1' # 可选,默认var(--textColor)
- name: George Chan
desc: 让我给你讲讲他的传奇故事吧
avatar: https://z3.ax1x.com/2021/09/30/4oKMVI.jpg
link: https://cyc0819.top/
bgColor: '#FFB6C1'
textColor: '#621529'
- name: Evan's blog
desc: 前端的小学生
avatar: https://cdn.staticaly.com/gh/xugaoyi/image_store/blog/20200103123203.jpg
link: https://xugaoyi.com/
bgColor: '#B9D59C'
textColor: '#3B551F'
```
:::
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
输出:
- name: butcher2000
desc: 即使再小的帆,也能远航
avatar: https://cdn.staticaly.com/gh/Kele-Bingtang/static/user/20211029181901.png
link: https://blog.csdn.net/weixin_46827107
bgColor: '#CBEAFA' # 可选,默认var(--bodyBg)。颜色值有#号时请添加单引号
textColor: '#6854A1' # 可选,默认var(--textColor)
- name: George Chan
desc: 让我给你讲讲他的传奇故事吧
avatar: https://z3.ax1x.com/2021/09/30/4oKMVI.jpg
link: https://cyc0819.top/
bgColor: '#FFB6C1'
textColor: '#621529'
- name: Evan's blog
desc: 前端的小学生
avatar: https://cdn.staticaly.com/gh/xugaoyi/image_store/blog/20200103123203.jpg
link: https://xugaoyi.com/
bgColor: '#B9D59C'
textColor: '#3B551F'
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 1. 语法
::: cardList <每行显示数量>
``` yaml
- name: 名称
desc: 描述
avatar: https://xxx.jpg # 头像,可选
link: https://xxx/ # 链接,可选
bgColor: '#CBEAFA' # 背景色,可选,默认var(--bodyBg)。颜色值有#号时请添加引号
textColor: '#6854A1' # 文本色,可选,默认var(--textColor)
```
:::
2
3
4
5
6
7
8
9
10
<每行显示数量>
:一行内显示多少个卡片,值范围 1~4,默认是 3 个,上方的卡片正好是三个,如果再多一个卡片,就会被换到下一行代码块需指定语言为
yaml
代码块内是一个
yaml
格式的数组列表数组成员的属性有:
name
:名称desc
:描述avatar
:头像,可选link
:链接,可选bgColor
:背景色,可选,默认var(--bodyBg)
。颜色值有#
号时请添加引号textColor
:文本色,可选,默认var(--textColor)
不指定颜色,默认为白色,如下演示:
::: cardList 2
```yaml
- name: 《静夜思》
desc: 床前明月光,疑是地上霜。举头望明月,低头思故乡。
bgColor: '#F0DFB1'
textColor: '#242A38'
- name: Vdoing
desc: 🚀一款简洁高效的VuePress 知识管理&博客(blog) 主题
link: https://github.com/xugaoyi/vuepress-theme-vdoing
bgColor: '#DFEEE7'
textColor: '#2A3344'
```
:::
2
3
4
5
6
7
8
9
10
11
12
13
14
《静夜思》
床前明月光,疑是地上霜。举头望明月,低头思故乡。
Vdoing
🚀一款简洁高效的VuePress 知识管理&博客(blog) 主题
- name: 《静夜思》
desc: 床前明月光,疑是地上霜。举头望明月,低头思故乡。
- name: Vdoing
desc: 🚀一款简洁高效的VuePress 知识管理&博客(blog) 主题
link: https://github.com/xugaoyi/vuepress-theme-vdoing
bgColor: '#DFEEE7'
textColor: '#2A3344'
2
3
4
5
6
7
8
# 十. 图文卡片列表v1.1.0 +
图文卡片列表容器,可用于 项目展示
、产品展示
等。
先看效果:
- img: https://cdn.staticaly.com/gh/xugaoyi/image_store/blog/20200529162253.jpg
link: https://xugaoyi.com/
name: 标题
desc: 描述内容描述内容描述内容描述内容描述内容描述内容描述内容描述内容 # 描述,可选
author: Young Kbt # 作者,可选
avatar: https://cdn.staticaly.com/gh/Kele-Bingtang/static/user/avatar2.png # 头像,可选
- img: https://cdn.staticaly.com/gh/xugaoyi/image_store/blog/20200530100256.jpg
link: https://xugaoyi.com/
name: 标题
desc: 描述内容描述内容描述内容描述内容描述内容描述内容描述内容描述内容
author: Young Kbt
avatar: https://cdn.staticaly.com/gh/Kele-Bingtang/static/user/avatar2.png
- img: https://cdn.staticaly.com/gh/xugaoyi/image_store/blog/20200530100257.jpg
link: https://xugaoyi.com/
name: 标题
desc: 描述内容描述内容描述内容描述内容描述内容描述内容描述内容描述内容
author: Young Kbt
avatar: https://cdn.staticaly.com/gh/Kele-Bingtang/static/user/avatar2.png
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
::: cardImgList
```yaml
- img: https://cdn.staticaly.com/gh/xugaoyi/image_store/blog/20200529162253.jpg
link: https://xugaoyi.com/
name: 标题
desc: 描述内容描述内容描述内容描述内容描述内容描述内容描述内容描述内容 # 描述,可选
author: Young Kbt # 作者,可选
avatar: https://cdn.staticaly.com/gh/Kele-Bingtang/static/user/avatar2.png # 头像,可选
- img: https://cdn.staticaly.com/gh/xugaoyi/image_store/blog/20200530100256.jpg
link: https://xugaoyi.com/
name: 标题
desc: 描述内容描述内容描述内容描述内容描述内容描述内容描述内容描述内容
author: Young Kbt
avatar: https://cdn.staticaly.com/gh/Kele-Bingtang/static/user/avatar2.png
- img: https://cdn.staticaly.com/gh/xugaoyi/image_store/blog/20200530100257.jpg
link: https://xugaoyi.com/
name: 标题
desc: 描述内容描述内容描述内容描述内容描述内容描述内容描述内容描述内容
author: Young Kbt
avatar: https://cdn.staticaly.com/gh/Kele-Bingtang/static/user/avatar2.png
```
:::
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# 1. 语法
::: cardImgList <每行显示数量>
``` yaml
- img: https://xxx.jpg # 图片地址
link: https://xxx.com # 链接地址
name: 标题
desc: 描述 # 可选
author: 作者名称 # 可选
avatar: https://xxx.jpg # 作者头像,可选
```
:::
2
3
4
5
6
7
8
9
10
<每行显示数量>
数字,表示每行最多显示多少个,选值范围 1~4,默认 3。在小屏时会根据屏幕宽度减少每行显示数量。- 代码块需指定语言为
yaml
- 代码块内是一个
yaml
格式的数组列表 - 数组成员的属性有:
img
:图片地址link
:链接地址name
:标题desc
:描述,可选author
:作者名称,可选avatar
:作者头像,可选
# 十一. Tabs插件
官网:https://github.com/pskordilakis/vuepress-plugin-tabs (opens new window)
安装插件:
在 .vuepress/styles/index.styl
添加如下内容:
@require '~vuepress-plugin-tabs/dist/themes/default.styl'
在 .vuepress/config.js
中添加如下内容:
module.exports = {
plugins: [ 'tabs' ]
}
2
3
启动项目,下面是使用的 demo。
:::: tabs cache-lifetime="5" :options="{ useUrlFragment: false }"
::: tab title
**markdown content**
:::
::: tab javascript
``` javascript
() => {
console.log('Javascript code example')
}
```
:::
::::
2
3
4
5
6
7
8
9
10
11
12
13
cache-lifetime
是存活时间,默认 5 分钟,即关闭网页五分钟内回来,当时选中的哪个 tabs,就会显示该内容,5 分钟后默认回到到第一个 tabs。
:options="{ useUrlFragment: false }"
建议写上,不然每次点击任意 tabs,都会刷新一次当前页面,没有必要。
效果如下: